|
capricious_001 wrote: LPINITCOMMONCONTROLSEX tabctl;
capricious_001 wrote: tabctl->dwSize = sizeof(tabctl);
Setting dwSize to the sizeof( a pointer) is not correct.
|
|
|
|
|
Hey Led,
Thanks for your reply. I dereferenced the pointer but I am still receiving the same error. I checked on google and someone some how was able to get it working by doing this:
<br />
LPINITCOMMONCONTROLSEX lpInitCommonControlsEx;<br />
<br />
lpInitCommonControlsEx.dwSize = (LPINITCOMMONCONTROLSEX);<br />
I'm not sure how that would even work but the person had successful results. I tried it with my code and I received syntax errors so I don't believe thats correct.
Did you have another idea how I could fix this?
Thanks,
Robbie
|
|
|
|
|
capricious_001 wrote: lpInitCommonControlsEx.dwSize = (LPINITCOMMONCONTROLSEX);
Try:
lpInitCommonControlsEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Robbie, DavidCrow has your "fix". I would be more concerned that you are writing C/C++ code but do not understand "how" these things work, or don't, as the case may be. This is a very fundamental aspect of C/C++ development. You should take the time to understand this before continuing on with the project.
good luck
|
|
|
|
|
LPINITCOMMONCONTROLSEX tabctl;
tabctl->dwSize = sizeof(tabctl);
tabctl->dwICC = ICC_TAB_CLASSES; You are dereferencing an uninitialized pointer, this is causing the crash.
TCITEM* ItemStruct;
ItemStruct->mask = TCIF_TEXT;
ItemStruct->pszText = tab1_title;
ItemStruct->cchTextMax = sizeof(tab1_title);
ItemStruct->iImage = 0;
ItemStruct->lParam = 0; Same problem here.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
Yes sir mike, I realized earlier on today that was the problem. I know enough about the fundamentals of C++ to handle this project involving the Win32 API. Just ran into a little roadblock thats all.
I tried the fix David gave but that wasn't the main problem (I already tried the way David had stated before so I know that wasnt the problem). I realized, instead of passing a pointer to InitCommonControlsEx function, I thought I would define the original structure (INITCOMMONCONTROLSEX) and pass it via reference to the InitCommonControlsEx function. That actually worked.
However I am running into another problem. The options Dialog appears and shows it has 2 tabs. However when the 2nd tab is clicked, it becomes "on top" or becomes focused, but the dialog control associated with it does not appear below the tab. Basically if I click any tab, it shows only the dialog control associated with the general tab (1st tab) and not the dialog controls associated with the tab that was chosen by the user. Below is the code for your perusal:
<br />
BOOL CALLBACK OptionsDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
HWND tab1_hwnd = NULL;<br />
HWND tab2_hwnd = NULL;<br />
HWND CurrentTabHwnd = NULL;<br />
int CurrentTabIndex;<br />
HWND hwndTab = NULL;<br />
<br />
switch(msg)<br />
{<br />
case WM_INITDIALOG:<br />
{<br />
<br />
LPSTR tab1_title = "General";<br />
LPSTR tab2_title = "Advanced";<br />
<br />
INITCOMMONCONTROLSEX tabctl;<br />
<br />
tabctl.dwSize = sizeof(tabctl);<br />
tabctl.dwICC = ICC_TAB_CLASSES;<br />
<br />
InitCommonControlsEx(&tabctl);<br />
<br />
hwndTab = GetDlgItem(hwnd,IDC_TAB1);<br />
<br />
TCITEM ItemStruct;<br />
<br />
ItemStruct.mask = TCIF_TEXT;<br />
ItemStruct.pszText = tab1_title;<br />
ItemStruct.cchTextMax = sizeof(tab1_title);<br />
ItemStruct.iImage = 0;<br />
ItemStruct.lParam = 0;<br />
<br />
SendMessage(hwndTab, TCM_INSERTITEM, 0, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab2_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(hwndTab, TCM_INSERTITEM, 1, (LPARAM)&ItemStruct);<br />
<br />
tab1_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_GENERAL), hwndTab, General_OptionsDialogProc, 0);<br />
tab2_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_ADVANCED), hwndTab, Advanced_OptionsDialogProc, 0);<br />
<br />
CurrentTabIndex = 0;<br />
CurrentTabHwnd = tab1_hwnd;<br />
<br />
ShowWindow(tab1_hwnd,SW_SHOWDEFAULT);<br />
<br />
<br />
}<br />
break;<br />
<br />
case WM_NOTIFY:<br />
{<br />
<br />
LPNMHDR lpnmhdr = (LPNMHDR) lParam; <br />
<br />
switch(lpnmhdr->code){<br />
case TCN_SELCHANGING:<br />
{<br />
ShowWindow(CurrentTabHwnd, SW_HIDE);<br />
SendMessage(hwndTab, TCM_GETCURSEL, 0, 0);<br />
<br />
switch(TabCtrl_GetCurSel(hwndTab)){<br />
case 0:<br />
ShowWindow(tab1_hwnd,SW_SHOWDEFAULT);<br />
CurrentTabHwnd = tab1_hwnd;<br />
CurrentTabIndex = 0;<br />
break;<br />
case 1:<br />
ShowWindow(tab2_hwnd,SW_SHOWDEFAULT);<br />
CurrentTabHwnd = tab1_hwnd;<br />
CurrentTabIndex = 1;<br />
break;<br />
}<br />
}<br />
break;<br />
default:<br />
return FALSE; <br />
}<br />
<br />
}<br />
break;<br />
case WM_COMMAND:<br />
{<br />
<br />
switch(LOWORD(wParam)){<br />
<br />
case IDOK:<br />
EndDialog(hwnd,0);<br />
break;<br />
case IDCANCEL:<br />
EndDialog(hwnd,0);<br />
break;<br />
}<br />
<br />
}<br />
break;<br />
case WM_CLOSE:<br />
EndDialog(hwnd, 0);<br />
break;<br />
<br />
default:<br />
return FALSE;<br />
}<br />
return 0;<br />
}<br />
<br />
<br />
I know the problem is for sure occuring at the WM_NOTIFY case and even more specifically the "case TCN_SELCHANGING" code block.
I want to know how do I find out through the message system which tab index is selected? If I can find out which tab index is selected then I can easily write code that will show the appropriate dialog window under the selected tab.
Thanks for your help,
Robbie
|
|
|
|
|
Can anyone point me to a copy of the source code to this old library anywhere?
I'm trying to port a project into VS2005 which has some old dependencies on this libary. I finally resolve all my compilation erros in my code only to discove VS2005 won't link to the old CJLibrary .lib files I have.
I think I need to rebuild the CJ .lib files using VS2005 - but I don't seem to have the full source any longer. It seems to have vanished from the net entirely.
I gather its been replaced by an all singing all dancing commercial version - but I can't find any reference anywhere to the old code. The new version looks to have totally changed so wouldn't be suitable. But the old free v6.09 library must be about somewhere!
Cheers
--
The Obliterator
|
|
|
|
|
I have a splitter with tree control in left pane and need to display bitmaps in the right pane.
There are many nice splitter samples here but none of them explains how to interact between left and right panes.
I tried to send message from parent to siblings but it did not work.
Thanks for reading.
Vaclav
|
|
|
|
|
Vaclav wrote: how to interact between left and right panes.
You want to interact between the "Views" in the panes yes? One way is to use CDocument::UpdateAllViews(...)
|
|
|
|
|
Not really,
I want the left pane tree control OnSelectionChanged method to display bitmap in the right pane.
Actually I want to have tab control in the right pane to display selected bitmas as required.
I can figure out the tab, for now I just need to interact from left pane to right.
Vaclav
|
|
|
|
|
Vaclav wrote: Not really
You don't have CView objects in the panes of the splitter window? Why not?
|
|
|
|
|
How to create a setup package to my C++ App ( i created it wusing VS C++ 6 ) lol the question was in the subject :p
thanx a lot
|
|
|
|
|
|
thanx
|
|
|
|
|
|
Hallo
After working for years my Software is ready. But it is not running on all Window machines. Especially Win2000 and WinXp cant start the software.
DrWatson tells me ntdll.dll 0x0000005 RtlEnterCritialSection
Ok some Access violation in ntdll but can i figure out what problem i realy have and what to do to fix it.
THX Timen
-- modified at 14:51 Monday 12th June, 2006
So here is the DrWatson result
<br />
*----> Statusabbild für Threadkennung 0x284 <----*<br />
<br />
eax=00000020 ebx=0013f360 ecx=7ffdf000 edx=00000020 esi=00000000 edi=0013f364<br />
eip=7c911010 esp=0013f2f0 ebp=0013f330 iopl=0 nv up ei pl nz na pe nc<br />
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202<br />
<br />
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\WINDOWS\system32\ntdll.dll - <br />
Funktion: ntdll!RtlEnterCriticalSection<br />
7c910ffc 0000 add [eax],al<br />
7c910ffe 0000 add [eax],al<br />
7c911000 90 nop<br />
7c911001 90 nop<br />
7c911002 90 nop<br />
7c911003 90 nop<br />
7c911004 90 nop<br />
ntdll!RtlEnterCriticalSection:<br />
7c911005 648b0d18000000 mov ecx,fs:[00000018]<br />
7c91100c 8b542404 mov edx,[esp+0x4]<br />
FEHLER ->7c911010 837a1400 cmp dword ptr [edx+0x14],0x0 ds:0023:00000034=????????<br />
7c911014 754f jnz ntdll!RtlEnterCriticalSection+0x60 (7c911065)<br />
7c911016 f0ff4204 lock inc dword ptr [edx+0x4]<br />
7c91101a 7519 jnz ntdll!RtlEnterCriticalSection+0x30 (7c911035)<br />
7c91101c 8b4124 mov eax,[ecx+0x24]<br />
7c91101f 89420c mov [edx+0xc],eax<br />
7c911022 c7420801000000 mov dword ptr [edx+0x8],0x1<br />
7c911029 33c0 xor eax,eax<br />
7c91102b c20400 ret 0x4<br />
7c91102e 8da42400000000 lea esp,[esp]<br />
7c911035 8b4124 mov eax,[ecx+0x24]<br />
And how to figure out witch thread is meant - or what to do against it ??
THX Timen
|
|
|
|
|
Check the Dr Watson log for more information. Access Violations are a bit too general to be able to narrow down your problem. Any other information about your app would help others help you as well.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Are you using any CRITICAL_SECTION s, or using any libraries that use them internally? Also, are you doing any custom heap management?
If the former, I would check to see that valid CRITICAL_SECTION objects are being maintained correctly. If the latter, I would check that all heap HANDLE s are being maintained correctly.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Can you attach a call stack?
Steve
|
|
|
|
|
Hi again guys
i have a stupit question
lets say i have an array of char
char string[50];
i put some characters in it and then i want to erase the content of the array so i can put some other characters in it
so anyone knows how i erase all the values from the array?
thanks a lot
|
|
|
|
|
If you put characters into array using strcpy function, the old characters will be overwritten by new string; therefore there is no need to erase the old content.
If you want to erase the old content in order to wipe some important information, for instance the password, you can use memset(string, 0, sizeof(string)) .
|
|
|
|
|
If what you want to have is just a null terminated C string. There's simply no need to erase the values of the array. The trailing 0 will be the thing signalling the end of the string. You must be dead sure that your string will never be more than 49 chars long. If not just use one of the string classes.
|
|
|
|
|
|
thanks toxcct
but if i overwrite and the new sequence of characters is smaller than the one before some values will still be in the array
for example if the the first time i insert 30 characters and the second time only 10
i ll have a problem yes?
thanks again
|
|
|
|
|
no, because C-Style strings are NULL terminated ; that means that the last character in the string is the character '\0', so that when this character is encountered, the reader knows he reached the end of the string (whatever bytes remaining in the trailing space of the buffer)...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|