![]() |
| | #1 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| Tabbed Windows with MDI? thanks
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org |
| willc0de4food is offline | |
| | #2 |
| Skunkmeister Join Date: Aug 2001
Posts: 2,572
|
__________________ Free the weed!! Class B to class C is not good enough!! And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi |
| Stoned_Coder is offline | |
| | #3 | ||
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| Awesome, thank you. Another problem i'm having is with this code: Code: default:
{
if(LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
{
DefFrameProc(hwnd, g_hMDIClient, WM_COMMAND, wParam, lParam);
}
else
{
HWND hChild = (HWND)SendMessage(g_hMDIClient, WM_MDIGETACTIVE,0,0);
if(hChild)
{
SendMessage(hChild, WM_COMMAND, wParam, lParam);
}
}
}
Dev-C++: Quote:
Quote:
so i tried copying over their entire WndProc() function, and it still gave me that error. so is there really a problem with that code? b/c i've been staring at it, bashing my head to no avail.. thanks.
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org | ||
| willc0de4food is offline | |
| | #4 |
| train spotter Join Date: Aug 2001 Location: near a computer
Posts: 3,451
| Try moving the declaration of HWND hChild (= NULL) to the top of the function. You are using .c files, which don't allow variable declarations in the middle of functions. They must be using .cpp files which do allow this type of declaration.
__________________ "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter." Friedrich Nietzsche "I spent a lot of my money on booze, birds and fast cars......the rest I squandered." George Best "If you are going through hell....keep going." Winston Churchill |
| novacain is offline | |
| | #5 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| ::meekly objects:: they download as .c files and on the website of the tutorial they state they will only be using .c files, no cpp. lol but they do use C++ style comments (at least what i was taught were C++ style comments... // instead of /* */) i'm still getting the same error though, no matter where HWND hChild is declared. what i dont get is it wants a ) before the ; on that line, but there is no ; on that line ? POPUP "&Edit" BEGIN So i just commented out the if part of my statement including the else so that it would just execute the code for the else situation..and it compiled and ran. *is really confused* ?? End MENUITEM "&Redo", ID_EDIT_REDO /* yep..lamer 8-) booyah */ so anyways, i tried different conditionals to see if something was going wrong in the if statement.. i changed my code to use whiles and i got the same error. Code: default:
{
409-> while (LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
{
DefFrameProc(hwnd, g_hMDIClient, WM_COMMAND, wParam, lParam);
}
while (!LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
{
HWND hChild = (HWND)SendMessage(g_hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (hChild)
{
SendMessage(hChild, WM_COMMAND, wParam, lParam);
}
}
}
WinTest02.c:413: error: syntax error before ';' token WinTest02.c:416: error: `hChild' undeclared (first use in this function) WinTest02.c:416: error: (Each undeclared identifier is reported only once WinTest02.c:416: error: for each function it appears in.)[/error]
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org Last edited by willc0de4food; 05-17-2005 at 01:58 AM. |
| willc0de4food is offline | |
| | #6 |
| train spotter Join Date: Aug 2001 Location: near a computer
Posts: 3,451
| >>they download as .c files hmmmmmmmmmm....OK..... You are including windows.h or there would be other errors.. Not the error if the resources were not included... Did you cut and paste the code? Prahaps there is a character in there we can't see... Could you post the file so I can have a look at the rest of the code.. Your not missing a brace ( } ) further up are you?
__________________ "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter." Friedrich Nietzsche "I spent a lot of my money on booze, birds and fast cars......the rest I squandered." George Best "If you are going through hell....keep going." Winston Churchill |
| novacain is offline | |
| | #7 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| by posting the file do you mean to paste all of the code in [code] tags? (its > 600 lines i believe) or do you mean to upload it to a website and then post a link to it on here? because i believe that would be easier and would shorten the post in a good way, lol. but i'm at college right now so i'll check back when i get home & post.
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org |
| willc0de4food is offline | |
| | #8 |
| Registered User Join Date: Sep 2004 Location: California
Posts: 3,020
| The code you have posted is correct, and should not generate any errors on a C compiler. You error is probably somewhere else in the function. You can probably just post the function in question, instead of the all the code. |
| bithub is offline | |
| | #9 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
|
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org |
| willc0de4food is offline | |
| | #10 |
| Work in Progress..... Join Date: Mar 2005 Location: Missouri. Go Imos Pizza!
Posts: 252
| Have you #defined ID_MDI_FIRSTCHILD, becuase it's not something pre-defined by #including windows.h. Check out http://www.winprog.org/tutorial. They tell you the purpose for that definition and how you should define it. If you haven't then that's probably the source of all of your errors, since there should be a number there, but instead, there's a bunch of characters that the compiler has no idea what to do with. That's one thing I wish a compiler could do more well: tell you if you're trying to use a pre-definition that isn't defined. But, sadly, computers cannot read our minds and we have to figure out if this is the source of an error ourselves. If it's not that, I'd still bet that you're using something that hasn't been defined, based on the error you got and the fact that there's an error on each line where it was used. The rest were probably caused because stuff like that throws off the compiler's reading. Last edited by Jaken Veina; 05-17-2005 at 04:19 PM. |
| Jaken Veina is offline | |
| | #11 |
| train spotter Join Date: Aug 2001 Location: near a computer
Posts: 3,451
| Don't have time right now to get it to compile without the res.h file. If you post it I will try again... I would... Comment out all the code. Leave only the case/break and see if it compiles. Then add the code back to find the culprit. Good luck..... EDIT: Opps
__________________ "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter." Friedrich Nietzsche "I spent a lot of my money on booze, birds and fast cars......the rest I squandered." George Best "If you are going through hell....keep going." Winston Churchill Last edited by novacain; 05-17-2005 at 08:50 PM. |
| novacain is offline | |
| | #12 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| http://www.freewebs.com/anarchy85/Res.h http://www.freewebs.com/anarchy85/Res.rc theres the other two files if you want to try to compile. whats opps? :-[ commenting & checking now... // edit k, this is the entirety of my function now: Code: LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
default:
{
if (LOWORD(wParam) >= ID_MDI_FIRSTCHILD)
{
DefFrameProc(hwnd, g_hMDIClient, WM_COMMAND, wParam, lParam);
}
else
{
HWND hChild = (HWND)SendMessage(g_hMDIClient, WM_MDIGETACTIVE, 0, 0);
if (hChild)
{
SendMessage(hChild, WM_COMMAND, wParam, lParam);
}
}
}
break;
}
break;
}
return 0;
}
also, i know that you dont need to include the break; for the default: situation, i just like to have it there just in case i accidently add some code after the default: lol. so the problem is in another function..i just dont know where? *starts searching*... except there is NO code before this except for the #include's, #define's, and HWND declarations..>:O the most furiating part is that if you remove the conditional, it compiles! *this is frustrating..and i can't focus on my hw b/c of it * lol
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org Last edited by willc0de4food; 05-18-2005 at 12:06 AM. |
| willc0de4food is offline | |
| | #13 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! I HATE THE COMPUTER! So I hard coded the number for ID_MDI_FIRSTCHILD (50000) in the if statement...compiles without a hitch >:O >:O >:O >:O >:O >:O >:O >:O but i'm still clueless as to how the ........ingsonofa..........pieceof........ has problems with one thing but not the other....
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org |
| willc0de4food is offline | |
| | #14 |
| train spotter Join Date: Aug 2001 Location: near a computer
Posts: 3,451
| Welcome to the wonderful world of programming Windows! Please leave your sanity at the door. Put the defines in a seperate header (or edit the res.h and add there if you dare!) EDIT: Once you get past the frustration ect *, it feels good to have solved it yourself? (*and get a replacement for the bits of your PC you smashed)
__________________ "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter." Friedrich Nietzsche "I spent a lot of my money on booze, birds and fast cars......the rest I squandered." George Best "If you are going through hell....keep going." Winston Churchill Last edited by novacain; 05-18-2005 at 01:08 AM. |
| novacain is offline | |
| | #15 |
| Shibby Join Date: Mar 2005 Location: MI
Posts: 376
| hahahaha ^_^ idk if my sanity even made it to the door.. but yea, it does feel good to have figured out the problem. which i will never understand, but i solved. and yea.. i wasn't sure if i wanted to stick those #define's in my header file b/c in their example, they were in the main code and in wondering if that could cause a problem, thats where they were placed. lol however, theres an updated version of my code and header / rc files that can be attained from the links above.Now, for a NEW headache ^_^ i want to incorporate a simple XOR encryption.. just so that when the file is opened in like notepad, my girlfriend or mom wouldn't be able to read it or be able to figure out "oh.. he just made a=b, b=c, etc.. this is the code i've come up with so far:Code: case ID_ENCRYPT_TEXT:
{
char algorithm[25] = "Az!By@Cx#Dw$Ev%Fu^Gt&Hs*";
int i;
DWORD dwTextLength;
dwTextLength = GetWindowTextLength(hwnd);
if(dwTextLength > 0)// No need to bother if there's no text.
{
LPSTR pszText;
pszText = (LPSTR)GlobalAlloc(GPTR, dwTextLength + 1);
if(pszText != NULL)
{
char windowText[dwTextLength + 1];
for (i = 0; i <= dwTextLength; i++)
{
windowText[i] = pszText[i];
}
if(windowText != NULL)
{
for (i = 0; i <= dwTextLength; i++)
{
windowText[i] = windowText[i] ^ algorithm[i % 20];
}
SetWindowText(hwnd, windowText);
}
}
}
}
break;
thanks// on a side note, as for the icons included in the code, i uploaded those as well ![]() // shibbyinc.ico | txticon.ico
__________________ http://willc0de4food.is-a-geek.com <- visit me :] Registered Linux User #380033. Be counted: http://counter.li.org Last edited by willc0de4food; 05-18-2005 at 02:51 AM. |
| willc0de4food is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to make a windows application | crvenkapa | C++ Programming | 3 | 03-26-2007 09:59 AM |
| Editor design: Traditional MDI versus Tabbed MDI | psychopath | Game Programming | 7 | 01-22-2007 07:48 AM |
| Script errors - bool unrecognized and struct issues | ulillillia | Windows Programming | 10 | 12-18-2006 04:44 AM |
| SDL and Windows | nickname_changed | Windows Programming | 14 | 10-24-2003 12:19 AM |
| Manipulating the Windows Clipboard | Johno | Windows Programming | 2 | 10-01-2002 09:37 AM |