D - strange bug
- imr1984 (14/14) Feb 04 2004 ok when my program calls CreateWindowExA it throws an exception, which j...
- davepermen (17/31) Feb 04 2004 "strings" like this get converted implicit to a 0-terminated string if y...
- imr1984 (6/47) Feb 04 2004 actually WINDOW_CLASS is declared like this:
- davepermen (9/64) Feb 04 2004 something else:D
ok when my program calls CreateWindowExA it throws an exception, which just says "Object" as usual. When I change the class name literal from WINDOW_CLASS (defined as "WndClass") to "tinky winky" it runs properly, but of course CreateWindowExA returns saying it cant find the window class name . For example: CreateWindowExA(dwExStyle, WINDOW_TITLE, WINDOW_CLASS, ... //throws exception CreateWindowExA(dwExStyle, WINDOW_TITLE, "tinky winky", ...//works Even stranger is that a few lines before I store the class name in a WNDCLASSEX struct like so: wc.lpszClassname = WINDOW_CLASS; and if i change that to: wc.lpszClassname = "tinky winky"; then CreateWindowExA with the correct class name DOESNT throw an exception, but of course cant find the class name "tinky winky" because it isnt registered. Can someone tell me what could cause this. Its driving me nuts as you can see...
Feb 04 2004
"strings" like this get converted implicit to a 0-terminated string if you pass them to a char* function. WINDOW_CLASS doesn't, i guess, as it's a full D string. oh, and, you can write twice the same name, to create the window. "thinky winky" for the wc.lpszClassName, and for CreateWindowEx(..,..,"thinky winky",...) else, toStringz in the std.string library helps i guess..... "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqk6o$mjj$1 digitaldaemon.com...ok when my program calls CreateWindowExA it throws an exception, whichjust says"Object" as usual. When I change the class name literal from WINDOW_CLASS (defined as "WndClass") to "tinky winky" it runs properly, but of course CreateWindowExA returns saying it cant find the window class name . Forexample:CreateWindowExA(dwExStyle, WINDOW_TITLE, WINDOW_CLASS, ... //throwsexceptionCreateWindowExA(dwExStyle, WINDOW_TITLE, "tinky winky", ...//works Even stranger is that a few lines before I store the class name in aWNDCLASSEXstruct like so: wc.lpszClassname = WINDOW_CLASS; and if i change that to: wc.lpszClassname = "tinky winky"; then CreateWindowExA with the correct class name DOESNT throw anexception, butof course cant find the class name "tinky winky" because it isntregistered.Can someone tell me what could cause this. Its driving me nuts as you cansee...
Feb 04 2004
actually WINDOW_CLASS is declared like this: const char[] WINDOW_CLASS = "WndClass"; so its a string literal. Anyway i disasembled teh program and both methods produce code that "pushes" a null terminated string literal to CreateWindowExA. so i still dont know whats going on. In article <bvqkc1$msj$1 digitaldaemon.com>, davepermen says..."strings" like this get converted implicit to a 0-terminated string if you pass them to a char* function. WINDOW_CLASS doesn't, i guess, as it's a full D string. oh, and, you can write twice the same name, to create the window. "thinky winky" for the wc.lpszClassName, and for CreateWindowEx(..,..,"thinky winky",...) else, toStringz in the std.string library helps i guess..... "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqk6o$mjj$1 digitaldaemon.com...ok when my program calls CreateWindowExA it throws an exception, whichjust says"Object" as usual. When I change the class name literal from WINDOW_CLASS (defined as "WndClass") to "tinky winky" it runs properly, but of course CreateWindowExA returns saying it cant find the window class name . Forexample:CreateWindowExA(dwExStyle, WINDOW_TITLE, WINDOW_CLASS, ... //throwsexceptionCreateWindowExA(dwExStyle, WINDOW_TITLE, "tinky winky", ...//works Even stranger is that a few lines before I store the class name in aWNDCLASSEXstruct like so: wc.lpszClassname = WINDOW_CLASS; and if i change that to: wc.lpszClassname = "tinky winky"; then CreateWindowExA with the correct class name DOESNT throw anexception, butof course cant find the class name "tinky winky" because it isntregistered.Can someone tell me what could cause this. Its driving me nuts as you cansee...
Feb 04 2004
something else:D is the code short enough to post? :D "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqmcs$qav$1 digitaldaemon.com...actually WINDOW_CLASS is declared like this: const char[] WINDOW_CLASS = "WndClass"; so its a string literal. Anyway i disasembled teh program and both methods produce code that "pushes" a null terminated string literal toCreateWindowExA.so i still dont know whats going on. In article <bvqkc1$msj$1 digitaldaemon.com>, davepermen says...you"strings" like this get converted implicit to a 0-terminated string ifWINDOW_CLASSpass them to a char* function. WINDOW_CLASS doesn't, i guess, as it's a full D string. oh, and, you can write twice the same name, to create the window. "thinky winky" for the wc.lpszClassName, and for CreateWindowEx(..,..,"thinky winky",...) else, toStringz in the std.string library helps i guess..... "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqk6o$mjj$1 digitaldaemon.com...ok when my program calls CreateWindowExA it throws an exception, whichjust says"Object" as usual. When I change the class name literal fromcourse(defined as "WndClass") to "tinky winky" it runs properly, but ofcanCreateWindowExA returns saying it cant find the window class name . Forexample:CreateWindowExA(dwExStyle, WINDOW_TITLE, WINDOW_CLASS, ... //throwsexceptionCreateWindowExA(dwExStyle, WINDOW_TITLE, "tinky winky", ...//works Even stranger is that a few lines before I store the class name in aWNDCLASSEXstruct like so: wc.lpszClassname = WINDOW_CLASS; and if i change that to: wc.lpszClassname = "tinky winky"; then CreateWindowExA with the correct class name DOESNT throw anexception, butof course cant find the class name "tinky winky" because it isntregistered.Can someone tell me what could cause this. Its driving me nuts as yousee...
Feb 04 2004
Ar solved it at last. The exception was thrown because I did not have a default handler in the switch statement of my WndProc. Dammit I wish the Error strings were a bit more descriptive then "Object". I could have solved it in 2 minutes instead of hours, if they were. In article <bvqn72$rrc$1 digitaldaemon.com>, davepermen says...something else:D is the code short enough to post? :D "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqmcs$qav$1 digitaldaemon.com...actually WINDOW_CLASS is declared like this: const char[] WINDOW_CLASS = "WndClass"; so its a string literal. Anyway i disasembled teh program and both methods produce code that "pushes" a null terminated string literal toCreateWindowExA.so i still dont know whats going on. In article <bvqkc1$msj$1 digitaldaemon.com>, davepermen says...you"strings" like this get converted implicit to a 0-terminated string ifWINDOW_CLASSpass them to a char* function. WINDOW_CLASS doesn't, i guess, as it's a full D string. oh, and, you can write twice the same name, to create the window. "thinky winky" for the wc.lpszClassName, and for CreateWindowEx(..,..,"thinky winky",...) else, toStringz in the std.string library helps i guess..... "imr1984" <imr1984_member pathlink.com> schrieb im Newsbeitrag news:bvqk6o$mjj$1 digitaldaemon.com...ok when my program calls CreateWindowExA it throws an exception, whichjust says"Object" as usual. When I change the class name literal fromcourse(defined as "WndClass") to "tinky winky" it runs properly, but ofcanCreateWindowExA returns saying it cant find the window class name . Forexample:CreateWindowExA(dwExStyle, WINDOW_TITLE, WINDOW_CLASS, ... //throwsexceptionCreateWindowExA(dwExStyle, WINDOW_TITLE, "tinky winky", ...//works Even stranger is that a few lines before I store the class name in aWNDCLASSEXstruct like so: wc.lpszClassname = WINDOW_CLASS; and if i change that to: wc.lpszClassname = "tinky winky"; then CreateWindowExA with the correct class name DOESNT throw anexception, butof course cant find the class name "tinky winky" because it isntregistered.Can someone tell me what could cause this. Its driving me nuts as yousee...
Feb 04 2004
Ar solved it at last. The exception was thrown because I did not have adefaulthandler in the switch statement of my WndProc. Dammit I wish the Errorstringswere a bit more descriptive then "Object". I could have solved it in 2minutesinstead of hours, if they were.Good evidence that the compiler should insist on the default, rather than causing developer or, worse, user consternation. Cyrille the SmartArse
Feb 04 2004