|
|
Yes. I meant to name it differently.
|
|
|
|
|
code good
add breakpoints what's second parameter at end function?
Kuphryn
|
|
|
|
|
Is it due to the local scope of revised_str?
- It's easier to make than to correct a mistake.
|
|
|
|
|
elephantstar wrote: CString new_date;
BOOL new_date;
new_date
Is this compile successfully.. i doubt
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
can someone please tell me how to change a font for a control in a dialog.
im a beginner and lost.
and when you format a CString like
CString temp;
temp.Format("%d", whatever);
where can i find all of the letters like the %d and what each does?
-- modified at 20:11 Monday 12th June, 2006
|
|
|
|
|
|
See CreatePointFont API's
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
locoone wrote: can someone please tell me how to change a font for a control in a dialog.
Create CFont Object and attach to the Control Window
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi!
First of all, sorry for my poor English and my stupidity.
I've been attempting to include the header file "cesync.h" in a vs2005 project and I don't know how the hell I'm getting lots of errors such as:
error C2065: '_JBLEN': undeclared identifier (file stdlib.h)
and many others...
About the code, all I have to say is that it's a new project (from scratch) and the include has been added before any other line in the .h auto-generated code. Thanks.
-- modified at 16:10 Monday 12th June, 2006
|
|
|
|
|
Hi there,
I am creating an application where one dialog box has a tab control with multiple tabs. I am having difficulties setting it up and would appreciate anyone who can shine some light on the issue. The program runs perfectly with the other controls but when one of my DialogProcs are called via a pushbutton control I get an unhandled exception error. Below is the code for your perusal:
<br />
<br />
BOOL CALLBACK OptionsDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
HWND tab1_hwnd, tab2_hwnd, CurrentTabHwnd;<br />
int CurrentTabIndex;<br />
HWND hwndTab;<br />
<br />
switch(msg)<br />
{<br />
case WM_INITDIALOG:<br />
{<br />
<br />
LPSTR tab1_title = "General";<br />
LPSTR tab2_title = "Advanced";<br />
<br />
LPINITCOMMONCONTROLSEX 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 />
<br />
if(!ShowWindow(tab1_hwnd,SW_SHOWDEFAULT))<br />
MessageBox(hwnd, "Could not initiate InitCommonControlsEx command", "Error:", MB_OK | MB_ICONINFORMATION);<br />
<br />
<br />
<br />
}<br />
break;<br />
<br />
case WM_NOTIFY:<br />
{<br />
switch(LOWORD(wParam)){<br />
case TCN_SELCHANGE:<br />
{<br />
ShowWindow(CurrentTabHwnd, SW_HIDE);<br />
CurrentTabIndex = SendMessage(hwndTab, TCM_GETCURSEL, 0, 0);<br />
<br />
switch(CurrentTabIndex){<br />
case 0:<br />
ShowWindow(tab1_hwnd,SW_SHOWDEFAULT);<br />
CurrentTabHwnd = tab1_hwnd;<br />
break;<br />
case 1:<br />
ShowWindow(tab2_hwnd,SW_SHOWDEFAULT);<br />
CurrentTabHwnd = tab1_hwnd;<br />
break;<br />
}<br />
<br />
<br />
<br />
}<br />
break;<br />
default:<br />
return FALSE; <br />
}<br />
<br />
}<br />
break;<br />
<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 />
Running it through my debugger it appears that the program experiences an error at this location:
<br />
tabctl->dwSize = sizeof(tabctl);<br />
tabctl->dwICC = ICC_TAB_CLASSES;<br />
I have also included the resources as well:
<br />
<br />
IDD_OPTIONS DIALOG DISCARDABLE 0, 0, 271, 166<br />
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU<br />
CAPTION "Options"<br />
FONT 8, "MS Sans Serif"<br />
BEGIN<br />
DEFPUSHBUTTON "OK",IDOK,7,145,50,14<br />
PUSHBUTTON "Cancel",IDCANCEL,214,145,50,14<br />
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,7,7,257,124<br />
END<br />
<br />
IDD_OPTIONS_GENERAL DIALOG DISCARDABLE 20, 15, 150, 60<br />
STYLE WS_CHILD<br />
FONT 8, "MS Sans Serif"<br />
BEGIN<br />
GROUPBOX "",IDC_STATIC,15,11,118,38<br />
LTEXT "General Tab",IDC_STATIC,53,26,44,8<br />
END<br />
<br />
<br />
IDD_OPTIONS_ADVANCED DIALOG DISCARDABLE 20, 15, 150, 60<br />
STYLE WS_CHILD<br />
FONT 8, "MS Sans Serif"<br />
BEGIN<br />
GROUPBOX "",IDC_STATIC,15,11,118,38<br />
LTEXT "Advanced Tab",IDC_STATIC,53,26,44,8<br />
END<br />
<br />
Everything looks to be correct so I am not sure as to what could be causing the issue. If this is of any help I am getting these compiler warnings as well:
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(95) : warning C4700: local variable 'tabctl' used without having been initialized
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(106) : warning C4700: local variable 'ItemStruct' used without having been initialized
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(137) : warning C4700: local variable 'CurrentTabHwnd' used without having been initialized
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(138) : warning C4700: local variable 'hwndTab' used without having been initialized
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(142) : warning C4700: local variable 'tab1_hwnd' used without having been initialized
C:\Program Files\Microsoft Visual Studio\MyProjects\RS_Stats32\RS_Stats32.cpp(146) : warning C4700: local variable 'tab2_hwnd' used without having been initialized
If you need some more information just give me a shout. Just FYI I am running on VC++ 6.0 on a WinXP machine.
Thanks,
Robbie
|
|
|
|
|
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
|
|
|
|
|