![]() |
|
Dynamic Libraries (Windows) - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26) +---- Forum: Petr (https://qb64phoenix.com/forum/forumdisplay.php?fid=52) +---- Thread: Dynamic Libraries (Windows) (/showthread.php?tid=4197) |
RE: Dynamic Libraries (Windows) - Pete - 12-18-2025 @Steffan-68 Winmm.dll (2 years old) and Winmmbase.dll (6 years old) are in my system32 windows folder. No other similar files or version available. Placing these two files in the QB64PE folder made no difference in this case. My system is 9 years old, and maybe these drivers are not up to date enough. Thanks for letting me know you had a similar situation. I thought I had missed some posted forum attachment. Pete
RE: Dynamic Libraries (Windows) - Petr - 12-18-2025 Problem, you talk about create program from reply #10. Use program from reply #14, this run correctly here (MJPG + ADPCM, or MJPG + PCM). Windows 10 64bit, all updates. RE: Dynamic Libraries (Windows) - Steffan-68 - 12-18-2025 (12-18-2025, 08:55 PM)Pete Wrote: @Steffan-68 For me it's 35
screenshot(30).bmp (Size: 1.34 MB / Downloads: 120)
RE: Dynamic Libraries (Windows) - Pete - 12-18-2025 I guess that's why they named it: WOW I found 3, but none work when copied to the QB folder. Pete
RE: Dynamic Libraries (Windows) - Unseen Machine - 12-19-2025 WinMM is like nearly as old as PETE! What is it you guys are trying to do? Can i help please as right now the Win API is my bi^ch! John RE: Dynamic Libraries (Windows) - Pete - 12-19-2025 I wish I was only that old. I suggest you invest in wax. My next birthday is coming soon! Hey John, Trying to get an AVI file to play on Petr's QB64 vid player: https://qb64phoenix.com/forum/showthread.php?tid=4197&pid=37859#pid37859 I get short sound loop only, and an error message that the app can't find the decompressor. So Petr wrote back to use post #14. I just tried it, but it causes the app to crash after about 10 seconds of that spinning windows progress circle. Oh well, maybe another day. Pete RE: Dynamic Libraries (Windows) - Mad Axeman - 12-19-2025 (12-15-2025, 06:30 PM)Petr Wrote: @Mad Axeman, I didn't forget. Here's a version of ListMenu for Windows without the top search bar. This time it's in the form of a .h file. This eliminates the need to create 32-bit and 64-bit DLLs.Thanks. At the moment work is getting in the way of things but that should stop next week. I'll take a look at it then. RE: Dynamic Libraries (Windows) - Unseen Machine - 12-19-2025 Pete, YOURE OLD MAN! Accept it! (Also if you talk to Ted, say hi from me!) Now, i can do it one of two ways but MY way is the best and easiest....so the first way (QB64 only code) aint gonna happen! From me telling Googles Ai the premise and then ages making tweaks and telling it to not be so smart as Im dumb here's and idea... FOR YOU ill make anything if i can or go for Aspirins after 2 days of failiure! TELL ME how youd want it, the requirements, what does QB64 need to see? (load, play, pause, volume etc...) and then bish bash bosh and you'll owe me a +1 Me, my idea is to allow for any number of AVIs to be loaded, each ones state stored internally and then each AVI referenced via index. QB64 will only ever need the index, when loading a new avi the index returned is that file and then all concurrent commands take said index and do their thing! John *NOTE the below is me chatting with google To implement the QB_AVI system, we will use a C++ structure (UDT) to track each video’s state and store them in a std::vector. The C++ layer will return a simple index to QB64. 1. The C++ Core (QB_AVI.cpp) This code manages the video metadata. We use mciSendCommand for speed and efficiency. cpp #include <windows.h> #include <mmsystem.h> #include <vector> #include <string> #define QB_EXPORT extern "C" __declspec(dllexport) struct QB_AVI_STATE { UINT deviceID; long start; long current; long end; int vol; // 0-1000 }; std::vector<QB_AVI_STATE> AVIs; QB_EXPORT int QB_AVI_Load(const char* filename) { MCI_OPEN_PARMS openParms = {0}; openParms.lpstrDeviceType = "avivideo"; openParms.lpstrElementName = filename; if (mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD_PTR)&openParms) == 0) { QB_AVI_STATE vid; vid.deviceID = openParms.wDeviceID; // Get length in frames MCI_STATUS_PARMS status = {0}; status.dwItem = MCI_STATUS_LENGTH; mciSendCommand(vid.deviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD_PTR)&status); vid.start = 0; vid.end = status.dwReturn; vid.current = 0; vid.vol = 500; AVIs.push_back(vid); return (int)AVIs.size() - 1; } return -1; } QB_EXPORT void QB_AVI_Render(int index, HWND hwnd, int x, int y, int w, int h) { if (index < 0 || index >= AVIs.size()) return; QB_AVI_STATE &v = AVIs[index]; // Bind to window MCI_DGV_WINDOW_PARMS win = {0}; win.hWnd = hwnd; mciSendCommand(v.deviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND, (DWORD_PTR)&win); // Set destination rectangle MCI_DGV_PUT_PARMS put = {0}; put.rc = { (LONG)x, (LONG)y, (LONG)(x + w), (LONG)(y + h) }; mciSendCommand(v.deviceID, MCI_PUT, MCI_DGV_PUT_DESTINATION | MCI_DGV_RECT, (DWORD_PTR)&put); // Play from current MCI_PLAY_PARMS play = {0}; mciSendCommand(v.deviceID, MCI_PLAY, 0, (DWORD_PTR)&play); } QB_EXPORT long QB_AVI_GetPos(int index) { if (index < 0 || index >= AVIs.size()) return 0; MCI_STATUS_PARMS status = {0}; status.dwItem = MCI_STATUS_POSITION; mciSendCommand(AVIs[index].deviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD_PTR)&status); return status.dwReturn; } Use code with caution. 2. QB64 Library Declaration In QB64, you link the compiled DLL. Note the use of _OFFSET for the window handle (essential for 64-bit compatibility in 2025). vb DECLARE DYNAMIC LIBRARY "QB_AVI" FUNCTION QB_AVI_Load% (filename AS STRING) SUB QB_AVI_Render (BYVAL index AS LONG, BYVAL hwnd AS _OFFSET, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL w AS LONG, BYVAL h AS LONG) FUNCTION QB_AVI_GetPos& (BYVAL index AS LONG) END DECLARE ' Usage SCREEN _NEWIMAGE(1280, 720, 32) vIndex% = QB_AVI_Load("test.avi" + CHR$(0)) IF vIndex% >= 0 THEN QB_AVI_Render vIndex%, _WINDOWHANDLE, 0, 0, 1280, 720 DO LOCATE 1, 1: PRINT "Current Frame:"; QB_AVI_GetPos(vIndex%) _LIMIT 60 LOOP UNTIL _KEYHIT = 27 END IF Use code with caution. Why this is a "Cake Walk" Vector Management: QB64 only passes a LONG index. You can load 100 AVIs and the C++ side manages the memory via the vector. UDT Logic: Properties like start, end, and vol are stored in the C++ struct. You can add getters/setters easily (e.g., QB_AVI_SetVol). Handle Safety: By using _WINDOWHANDLE, the video is clipped and rendered directly by the Windows display driver into your QB64 workspace. SIDE NOTE : From my current DEV ive learned that there is NEXT TO NOTHING we cant add to QB64 using C/C++ wrappers and declare lib...SO IF ANYONE WANTS ANYTHING else like this...ask and i will deliver or tell you im too dumb to do it! Second note @ DEVS : ADD A _Screen function...I KNOW that GL 4.6, DX 9-11/12 and VULKAN are not HARD to implement. In fact id wager that at least for Gl no more than 5 or 6 lines of code need to be added to allow Qb64 to use all GL functionality! (Not bragging here but Galleon used SFML to demo Declare library and GL. He was VERY against adding GL to QB64 until i showed my work, begged and pleaded and eventually he made the work around we have today) That was 2011 and even then it was OLD! My new GDK allows for any number of screens in any render mode, GL DX etc...so if you dont add it I will! John RE: Dynamic Libraries (Windows) - Petr - 12-19-2025 @Pete First question. Does the video that doesn't play play in VLC, or WMP, or a media player? What operating system are you using for that? Attached is an MJPG video with ADPCM sound (output of a program written in QB64PE without C language) - the quality is terrible but it's for the purpose of testing the function for you. This video plays in this player for me. How does it work for you? Do you have the necessary codecs on your computer? There were 2 small bugs in that program that test the error return code, but that doesn't affect the playback itself. Try it and let me know. Code: (Select All)
ZIP file contains 20 seconds AVI (MJPG/ADPCM) RE: Dynamic Libraries (Windows) - Petr - 12-19-2025 This is a video player written in C++. Attached are the 32-bit and 64-bit DLLs, the source code, BAS program and all the files needed for compilation. The only bug in the program is that it cannot be run in fullscreen mode, because the video window then hides behind the QB64PE screen. I will be porting this program to Linux in the near future as well - I finally finished installing Linux yesterday to laptop with everything that’s needed. The program includes options to fast-forward and rewind, play at reduced, normal, or increased speeds, control the volume, and pause/resume the video. Of course, you can position it anywhere on the screen (with adjustable width and height for the video playback). There is also an option to zoom the video in or out using the + and - buttons. |