Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - I need a resource editor! | | | |
Pages: 1 2 3 4 | Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4297/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well I'm getting around 400% speeds, and I think even NO$GMB uses GDI. I will check that out though. Do you need to have some special program installed for that like with DirectX though? I suppose 8-bit could work if I dump the palettes into it whenever they're changed. [edit] Also how can I get the size of the window borders and title bar? CreateWindowEx() seems to be including them in the window's size, so my actual drawing area is too small. Bah, more fun bugs. I'm writing the colours 183C4A, 397D9C, 5AB6DE and 8CEBFF. It's drawing the colours 394900, 7B9E00, B5DF00 and EFFF00. It works fine if I use 000000, 404040, 808080 and C0C0C0. (edited by R2H2 on 04-29-05 06:48 AM) (edited by R2H2 on 04-29-05 12:51 PM) (edited by R2H2 on 04-29-05 05:07 PM) |
|||
Parasyte Bullet Bill Level: 35 Posts: 481/514 EXP: 267348 For next: 12588 Since: 05-25-04 Since last post: 104 days Last activity: 32 days |
| ||
Visualboy Advance can be set to use GDI. If you try it, you'll see how much slower it is compared to DirectX. For SDL, all you need to "install" is a dll. Either place it in the directory with the SDL-reliant executable, or in your Windows System directory. Just standard dll stuff, there. For more info, check out the website: http://www.libsdl.org/ Your problem with window sizing can be solved by using AdjustWindowRectEx() before calling CreateWindowEx(). Finally, you are writing the colors backwards (BEHOLD! THE CURSE OF LITTLE ENDIAN!) When you group the RGB color components into a 32-bit word, you must do so as in the following example:
You could also use the RGB() macro, which tends to make much more sense:
(edited by Parasyte on 04-29-05 09:21 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4303/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Huh, that's odd... They don't look backward, and reversing them didn't help, but using RGB fixed it. AdjustWindowRectEx, however, isn't doing much of anything, which might be because for some reason 'you cannot specify the WS_OVERLAPPED style'. (edited by R2H2 on 04-30-05 06:04 AM) |
|||
Parasyte Bullet Bill Level: 35 Posts: 483/514 EXP: 267348 For next: 12588 Since: 05-25-04 Since last post: 104 days Last activity: 32 days |
| ||
Sounds about right. Here's why:#define WS_OVERLAPPED 0 D'oh! ;P I wrote a quick function to resize any window by specifying the client area's width and height. It doesn't take into account scrollbars, but I figure you won't care about that, any way.
Just call it from your WM_CREATE message handler: SizeToClientRect(hwnd, 640, 480); with whatever size you want the client area to be. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4304/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Thanks! If you don't mind I'm just going to copy that right in there. [edit] Bah! Maybe there's something screwy with my computer or something. It's doing exactly the same as AdjustWindowRectEx() did. (edited by R2H2 on 04-30-05 12:42 PM) |
|||
Parasyte Bullet Bill Level: 35 Posts: 484/514 EXP: 267348 For next: 12588 Since: 05-25-04 Since last post: 104 days Last activity: 32 days |
| ||
Debug it. After the MoveWindow() stuff, call GetClientRect() again and print the results. If it's what you expect (the params you passed as w,h) then your logic is flawed, not the computer. ;o | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4349/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well I tried that PE Module Explorer. Very, very happy to say windres didn't have any complaints about its output, and its GUI is decent too. (Lacks some features, but ehh.) Problem is I can't get the dialog to show up. DialogBox() returns -1 and GetLastError() is 0./* main.h */ I compile like so: echo Building resources... (Some lines have been split up to not stretch the page. Anyone know how to put a horizontal scrollbar in there? ) MSDN says the function returns -1 (actually, "Â?1"; I assume that's supposed to be -1) on error, but I'm not getting any errors. [edit] Interesting dump of the window messages: WM_SETFONT 0x320A0BC2 0x00000000 WM_COMMAND 0x04000002 0x00F70194 WM_COMMAND 0x03000002 0x00F70194 WM_DESTROY 0x00000000 0x00000000 WM_NCDESTROY 0x00000000 0x00000000 (edited by R2H2 on 05-06-05 01:47 PM) (edited by R2H2 on 05-06-05 01:49 PM) (edited by R2H2 on 05-06-05 07:39 PM) |
|||
sloat Level: 16 Posts: 47/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
DialogProc should return TRUE if you handle a message. What does GetLastError() return after DialogBox fails? Also, the flags for MessageBox are the last parameter. Not that it matters in your code, since MB_OK = 0 |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4375/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Ah, yes, MSDN lists the messages as returning 0, but apparently that doesn't apply to DialogProc. It's still doing it though, and GetLastError() returns 0, which really baffles me. (edited by R2H2 on 05-07-05 06:08 AM) |
|||
Dish Spiny Level: 38 Posts: 396/596 EXP: 355646 For next: 14801 Since: 03-15-04 From: Disch Since last post: 18 days Last activity: 18 days |
| ||
Are you still using 0 for the dialog ID? That's the only thing I can see that's flakey. Double check to make sure the dialog uses the proper ID in whatever resource editor you're using, and make sure 'frmMain' shares the same integer as the dialog. If you can, try changing it to something other than zero (perhaps zero has some special significance or something?) Only other thing I can think of is maybe you have to create a parent window for the dialog -- but you shouldn't have to for Modal dialogs. I'll put my money on the resource ID though. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4378/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
No, I tried 9999 and even "frmMain" (apparently I can use strings ) but the same thing happens. DialogBox should be returning 0 if it were a problem with the parent window. WM_COMMAND 0400xxxx means mouse down doesn't it? And 0300xxxx means mouse up? So it would seem like something is being clicked. (Judging by the 2 in the lower half, it should be a text box...) Also interesting that there's no WM_CREATE messages... (edited by R2H2 on 05-07-05 10:01 AM) |
|||
Dish Spiny Level: 38 Posts: 397/596 EXP: 355646 For next: 14801 Since: 03-15-04 From: Disch Since last post: 18 days Last activity: 18 days |
| ||
Originally posted by R2H2 Ah, you're right. I missed that part when I looked it up. So it's not the parent window. It's not the Dialog Proc It's not the HINSTANCE (at least not in the code you pasted before) Only thing left is the resource ID -- only thing I can think of is the resource editor you're using doesn't make the dialog to have the same ID as what's defined in your header file.
Not to my knowledge -- I don't know what those codes mean (I tried looking them up, didn't find anything). WM_LBUTTONDOWN and WM_LBUTTONUP are used for mouse clicks -- they don't go through WM_COMMAND afaik (could be wrong though... WM_COMMAND is pretty strange).
Dialog Boxes don't get WM_CREATE messages (and least not if you use DialogBox). Instead you get a WM_INITDIALOG. Actually, Dialogs are half-assed windows -- not all messages get through to your message handler. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4380/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
I verified it in Resource Hacker, the ID is right. I generally get errors when it isn't. | |||
sloat Level: 16 Posts: 48/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
Where are you getting those window messages from? You wouldn't be getting any window messages if the dialog wasn't created. If those are the only messages you're getting and in they come in that order, then it should be pretty clear that it's getting destroyed quickly. WM_COMMAND is sending the EN_UPDATE (0x0400) and EN_CHANGE (0x0300) notifications. 0x0002 should be the control ID of the edit box. Dunno why, but it's probably just routine stuff for the edit control. This probably won't have anything to do with it, but when dealing with GetDlgItem or related functions, you shouldn't use MAKEINTRESOURCE on the control ID. Just use the constant and you won't have to cast it as an int. Make sure you didn't specify a class name for your dialog box. Other than that, I'm out of ideas. |
|||
Dish Spiny Level: 38 Posts: 398/596 EXP: 355646 For next: 14801 Since: 03-15-04 From: Disch Since last post: 18 days Last activity: 18 days |
| ||
Is your WM_CLOSE section being called right away for some reason? Try taking that part out, and instead have WM_COMMAND with BN_CLICKED for IDCANCEL and IDOK your close markers (which I think is what you're supposed to do anyway). | |||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4392/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
No, I looked at that. It would output some text if WM_CLOSE executed. Not using MAKEINTRESOURCE gives the error "passing arg 2 of `DialogBoxParamA' makes pointer from integer without a cast", but doesn't seem to fix anything. How would I go about setting (or rather, making sure there isn't) a class name? The entire output is this. I've added a bit right at the beginning of DIalogProc: printf("%08X %08X %08X %08X\n",hwndDlg,uMsg,wParam,lParam); Loading... Also, changing DialogBox to CreateDialog, it returns 0 but still no error code. (I stuck a loop after it to keep it running until it gets a WM_CLOSE, but it just runs forever.) [edit] Hah! I set the No Fail Create flag and now it works for the most part. The problem seems to be that some controls couldn't be created, namely the slider and progress bar. Why might that be? [more editing fun] Have to call InitCommonControls() first, apparently. If only the INITCOMMONCONTROLSEX struct existed so I could use InitCommonControlsEx() even though it's rather unnecessarily complex instead of this apparently obsolete function. And more fun problems arise: -Radio buttons can all be checked at once despite having the Auto and Group attributes. -Scrollbars don't scroll and are always at position 0. -I can't get any text into a combo box. I add 3 strings and get the return values 2, 1, 0 (not 0, 1, 2 ) and no error code, but they're not there. -Just how the heck do you tell what control a message is coming from in DialogProc? It doesn't contain an ID or a handle. I'm getting WM_HSCROLL messages from two different places and don't see any way to tell what's being scrolled. (edited by R2H2 on 05-07-05 04:39 PM) (edited by R2H2 on 05-07-05 04:44 PM) (edited by R2H2 on 05-07-05 04:48 PM) (edited by R2H2 on 05-07-05 04:54 PM) (edited by R2H2 on 05-07-05 05:11 PM) (edited by R2H2 on 05-07-05 05:22 PM) (edited by R2H2 on 05-07-05 07:42 PM) |
|||
Parasyte Bullet Bill Level: 35 Posts: 504/514 EXP: 267348 For next: 12588 Since: 05-25-04 Since last post: 104 days Last activity: 32 days |
| ||
1) Radio buttons and Check boxes must be manually checked in WM_INITDIALOG message handler using CheckRadioButton() or CheckDlgButton(). 2) Scrollbars never automatically scroll by themselves. You must handle the scroll messages to make them scroll. (see example code, below.) 3) To add text to Combo boxes, you must send the CB_ADDSTRING message to them. 4) About WM_VSCROLL and WM_HSCROLL messages: lParam If the message is sent by a scroll bar, then this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL. In the case that lParam is NULL, it means the message is coming from the scrollbar owned by the window whose messages are being handled. Since you are using scroll bar CONTROLS, lParam will contain the control ID. Example of scroll bar handling:
Where si is declared as SCROLLINFO si; .For scroll bar controls, the call to GetScrollInfo() and SetScrollInfo() will be a bit different. You'll pass the handle returned from GetDlgItem() and SB_CTL, rather than SB_VERT. In my case, the scroll bar is owned by the window whose messages are being handled. And of course, the comment before the return statement is where you would handle the actual scrolling of content. Oh, and don't forget to setup the scrollbar's initial values in WM_INITDIALOG:
This example will set the scroll bar range as 0 - 10000, with a page size of 20. Again, this is for a child scrollbar, and will need a small bit of changes to work with a scroll bar control. You should really use MSDN more often, rather than trying to work things out for yourself through debugging. MSDN covers almost every topic imaginable in Win32 programming. You just have to know where to find it. (edited by Parasyte on 05-08-05 05:47 PM) (edited by Parasyte on 05-08-05 06:14 PM) (edited by Parasyte on 05-08-05 06:15 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4414/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Yeah, that's the problem. Navigating a Microsoft site. I am using the CB_ADDSTRING message though. | |||
Parasyte Bullet Bill Level: 35 Posts: 507/514 EXP: 267348 For next: 12588 Since: 05-25-04 Since last post: 104 days Last activity: 32 days |
| ||
It's always worked for me. Here's an example using CB_INSERTSTRING, instead:
|
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 4433/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
No, that's not doing it. Could it be that I used SendMessage instead of SendDlgItemMessage? I grab all the control handles into an array indexed by their ID when the program starts, and they all look alright. Or it could be the message itself? SendMessage(hwnd,CB_ADDSTRING,0,(LPARAM)str) Everything else is working now though although I haven't tried menus yet... (edited by R2H2 on 05-10-05 02:11 PM) |
Pages: 1 2 3 4 | Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - I need a resource editor! | | | |