I had tried using a C header to get around the problem I was having (on the main forum), but I couldn't make it work. I guess I'll wait for the next update to try again with QB64.
Anyway, here is a C program.
I'm not sure of the best way of initializing Unicode strings without null termination. I do it here by using a sequence of hex word values. I tried using individual letters in quotes, but it didn't work.
I'm not sure why I need to cast &Filename as LPWSTR, since LPWSTR means a pointer to a WCHAR ("typedef WCHAR *LPWSTR;"), and Filename is a WCHAR array...
I used the windows.h header partly for convenience, and partly because I would think QB64 uses it. It shouldn't be necessary, though. It should be possible, but maybe not preferable, to just include custom prototypes for the API functions without using the Windows header files. You wouldn't have HANDLE, you would have void * (although I would probably just use unsigned long int). You wouldn't have DWORD, you would have unsigned long int. You wouldn't have WCHAR, you would have unsigned short int. There sure are a lot of typedefs in the windows header files. I guess it's more convenient just to use the Windows header files, and Microsoft's myriads of types.
I'm not sure if the compiler considers a new type to be compatible to the type it was derived from using typedef.
stdout = GetStdHandle(0xfffffff5);
l = GetModuleFileNameW(0,(LPWSTR) &Filename,0x200);
WriteConsoleW(stdout, &msg0, 0x13, &trash, 0);
WriteConsoleW(stdout, &Filename, l, &trash, 0);
WriteConsoleW(stdout, &crlf, 0x2, &trash, 0);
WriteConsoleW(stdout, &msg1, 0x16, &trash, 0);
Return to Index
|Response Title||Author and Date|
|I see the bug||ComputerGhost on Sep 14|
|Interesting.||Michael Calkins on Sep 15|
|Re: Interesting.||ComputerGhost on Sep 15|
|Re: Interesting.||Michael Calkins on Sep 15|
|Re: Interesting||ComputerGhost on Sep 15|
|Re: Interesting||Michael Calkins on Sep 16|
|* const data goes in .rdata, not .text||Michael Calkins on Aug 22|