|
I’m using visual studio 7.0 2003 with c++ and MFC.
In the debugger when I’d put the cursor on a CString object I’d automatically see its value. Now, in a new project I only see things like “sql = {…}”.
I have to go down to a watch window where it is defined as
ATL::CSimpleStringT<char,0> and underneath that
m_pszData with the actual data.
Upon further investigation I see it is dependent upon if I use Managed Extensions. Without the managed extensions, I see the CString objects directly under the cursor in the debugger.
If I go to a watch window, it is defined slightly differently
ATL::CSimpleStringT<char,1> and again
m_pszData with the actual data.
Does anyone know what is the meaning of the difference and if I can do something in order to see CStrings like I’ve always seen them?
Thanks,
Ilan
|
|
|
|
|
Hello!
I have a big problem. Since yesterday morning I am experimenting, but i am not able to solve it. Since yesterday morning the VC++ 7.1 Linker (link.exe) shows me the error "Buffer Overrun detected".
It's no matter, which Project I am trying to link nor if I start the Linking from Visual Studio .Net or via the command line (with link.exe)
I already re-installed Visual Studio .Net for 3 times and scanned my Hard-Disks with Antivir PE, AdAware, HiJackthis, Spybot S&D and A-squared for Virus, Malware, Spyware,... and deleted everything it found.
After that I downloaded all from link.exe needed DLLs (msvc71.dll, mspdb71.dll,...) and replaced them, but this didn't solve my problem too.
At Last i tried so find the reason for the Problem with FileMon (www.sysinternals.com) but also without any success.
And no i am at a loss. Except a complete Operating System Reinstall i don't know anything more to solve the problem. Everything looks like it's bewitched.
Has anybode made the same experience?
Does anybody know how to solve this problem?
Many thanks in Advance!
|
|
|
|
|
Hello,
I need to know how to hide a CPropertyPage at runtime in my app. I thought that it could be done by first removing all the pages
while (m_sheet.GetPageCount()) {
m_sheet.RemovePage(0);
}
and than adding the pages (except the one i want to hide) to the sheet again
m_sheet.AddPage(&m_tree, 0);
m_sheet.AddPage(&m_calculate,7);
m_sheet.AddPage(&m_cad,12);
The problem is that removing a page in the way i did will destroy the page and adding the page will recreate it. But I need to hold the state of the page furthermore. Maybe someone has an idea!
Best regards,
Tabor
|
|
|
|
|
See if MSDN article Q151662 helps. I've used it in several of my projects.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thank you very much,
i will check this!
Best regards
Tabor
|
|
|
|
|
sorry couldnt get the article Q151662 .Searched in msdn site and google.too.
Thanx for the info.
Meanwhile I tried a lot to disable the save tool button on the toolbar. I tried SetButtonInfo in the foll. code but in vain.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
TBBUTTONINFO buttonInfo;
UINT buttonID;
buttonID = ID2_FILE_SAVE;
m_wndToolBar.GetToolBarCtrl().GetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
buttonInfo.fsState = TBSTATE_INDETERMINATE ;
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID2_FILE_SAVE, &buttonInfo);
return 1;
}
laiju
|
|
|
|
|
laiju wrote:
sorry couldnt get the article Q151662 .Searched in msdn site and google.too.
Really?
http://support.microsoft.com/default.aspx?scid=kb;en-us;151662
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
thanx for the link i have fixed it already.
thanx once again
laiju
|
|
|
|
|
I have a CWnd object which I use for drawing a chart using OpenGL. The CWnd has vertical and horizontal scroll bars and is owned by a formview derived class.
When I open a dialog box above the CWnd object and then close it again, the CWnd object does not refresh (the chart is grey and the scroll bars are blank where the dialog was).
My drawing code function is called by OnPaint. So therefore it appears that when the dialog is closed WM_PAINT is not called!
I've tried called UpdateWindow in PostNcDestroy on the dialog, but this causes a crash.
Any thoughts?
Thanks, James
|
|
|
|
|
try [InvalidateRect] or [CWnd::Invalidate]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Where should I call Invalidate?
If I call it in OnOk() it invalidates the entire CWnd object and makes it blank, without calling OnPaint.
If I call Invalidate in PostNcDestroy it causes a crash!
|
|
|
|
|
i have created a push button using Create Window. Now
1. how do i write text on the button?
2. how do i handle the button WM_COMMAND?
the code snippet is:
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); wc.lpszClassName = "WndClassName";
if(!RegisterClass(&wc))
{
MessageBox(NULL,"Failed To Register The Window class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return (NULL);
}
HWND hWindow = CreateWindowEx(NULL, "WndClassName","DialogClassSample",WS_OVERLAPPEDWINDOW | WS_VISIBLE,0, 0, 320, 200, NULL, NULL, GetModuleHandle(NULL), NULL);
HWND ButtonWindow = CreateWindow("BUTTON",NULL, BS_TEXT|BS_PUSHBUTTON|WS_VISIBLE|WS_CHILD,50,50,30,20,hWindow,NULL,NULL,NULL);
MSG msg;
BOOL bDone = FALSE;
while(!bDone)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message==WM_QUIT)
{
bDone = TRUE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
|
|
|
|
|
1. SetWindowText should help you put the text over the button
2. You need to give your Window Procedure where in you can handle the messages (In a way that we use to do in SDK)
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
My Window procedure is:
LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) {
switch (uMsg)
{
case WM_COMMAND:
{
PostQuitMessage(0);
return 0;
}
break;
case WM_CLOSE:
{
PostQuitMessage(0);
return 0;
}
break;
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
Here i have handled the WM_COMMAND message.
but my problem is if i create 2 push buttons and i want seperate handling for the buttons, how do i distinguish the WM_COMMAND of one button from the WM_COMMAND of the second button?
|
|
|
|
|
1.Low-order of WParam would be having the button identifier, compare that with the list of id's that you gave at the time of creation
2. Compare your button handle with in coming hwnd parameter
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
how do i compare low-order of WParam. i did not create any list of ids. i checked the low-order of WParam. it outputs 0.
Secondly, how do i compare the handle. The button handle is declared in WinMain() and i need to compare in WndProc(i m not able to get the button handle in WinProc)
|
|
|
|
|
1. The LOWORD macro retrieves the low-order word from the specified value.
2. Instead of using createwindow try using create of CWnd this would allow you to set the control's id. Store thos id's in some array and check them in your wndproc function.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
I want to use CreateFile for creating of new files, overidding existing ones or just simply open them in various modes (depending on my applications' requirements). I know that when it fails it returns INVALID_HANDLE_VALUE and I have to use the GetLastError to find why. However, the GetLastError is a generic system function. Is anywhere any documentation about what errors can be the result of CreateFile. How do I know e.g. if I failed 'cause tried to create an existing file, tried to open an non-existing file, do not have enough disk space, do not have access to the parent directory, lost connection with a remote file store etc.
A cross reference list function-possible failures would be usefull for any Win32 function (I am looking for it not only for the CreateFile).
Anyone can point me to such documentation (books, web pages, etc) will be much appreciated.
Life is a river with mist ahead...
|
|
|
|
|
I don't know if there is such a list but what you can do is use the Error Lookup tool. It is already in the tools in Visual C++ 6. You give the error code and it displays the corresponding error string.
|
|
|
|
|
Alternate to error lookup you can as well use FormatMessage API(Though output is same in either case ).
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Thanks for your help.
I am aware of the FormatMessage API. The Error Lookup is also a good tool. However, all these come from the wrong direction; once you know the error.
My problem is that I cannot find documentation about all possible errors. I would like to write a switch statement of the GetLastError numbers and direct my code to handle important errors in a more appropriate manner than reporting them to the user. And there is where my problem comes. I do not have a list of those errors; not only for CreateFile but for almost and window function.
Look the UNIX manual for open() (E.g. in http://www.rt.com/man/open.2.html) They have a list of all possible errno values that open may return, not all possible errno values in the whole O.S. Why Microsoft never does that for Win32?? Or if it did where can I find it?
Thanks for any help
Life is river with mist ahead...
|
|
|
|
|
Well, maybe because it's difficult to maintain such a documentation.
If you're interested, you can look into the <winerror.h> header, where most of errors are described (found in any good Windows SDK)
Don't know if it does any good to you, but at least tried
|
|
|
|
|
Consider using CFile::Open() instead. That will allow you to switch on these[^] error codes contained within a thrown CFileException .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Consider using CFile::Open() instead. That will allow you to switch on these[^] error codes contained within a CFileException .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|