|
Hi.
Look at the answer from douglasjordan, above. I just want to complete his answer on your 3:rd point:
If you shift window in the workspace (with ctrl-tab), then you will get back to your code. Look at the green arrowhead (or possibly the line above it). That's where your program called the function that was shown i assembler.
|
|
|
|
|
Further on the third point, you should have an option to display the Call Stack in a window (most likely View->Debug->Call Stack, or Alt-V,D,C). The current level will be highlighted. Trace down the call stack to the first routine that you recognize, and double-click there. This should pop up a window with your source code so that you can see where the offending call is being made.
The nice thing about the call stack is that you can display different variables in the Watch Window, depending on where you are in the call stack. As you double-click to display a function at various levels in the Call Stack, Visual Studio reverts to that function's context, so you can display local variables.
The Call Stack window also shows the parameters that are passed to functions, so you can see if something was sent that "broke" stuff.
Bob Ciora
|
|
|
|
|
I am working with a dialog based application having 9 (nine) edit field arranged in 3X3 matrix form. The dialog is also having three buttons (OK, Cancel and Process). I want the program do as follows:
1. When the user presses an arrow key (left, right, up and down) while in any edit field the focus should move to desired edit field only (not to OK or any other button)
2. Capture the keboard input (like ALT, CTRL etc. to be processed diffrently when in the focus is in edit field).
I came to know that dialogs with buttons and any other controls cannot capture keyboard input. Is it true?
Please help.
pani
|
|
|
|
|
By using CreateDialog this is fairly simple from a c based app that has a message loop dispatcher - you merely intercept the desired messages and call the dlgproc directly versus dispatching it to the message que where the default handler will take care of them and not forward. It will not be easy from a c++ class based app without access to the message dispatcher.
|
|
|
|
|
I am using (not very seasoned in) VC++6 and MFC to create the dialog based application.
Pani
|
|
|
|
|
You can override PreTanslateMessage in the Dialog class...
Inside which you can check for the desired message.
Eg:
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_UP)
{
//TODO:
//Logic to set the focus
}
}
For the keys like Control,you can get the state by using GetKeyState function
Eg:
if((GetKeyState(VK_CONTROL) & 0x8000)
{
//TODO:
}
|
|
|
|
|
Thanks!
It worked fine.
Pani
|
|
|
|
|
Thanks for the vote
|
|
|
|
|
pani68 wrote: 1. When the user presses an arrow key (left, right, up and down) while in any edit field the focus should move to desired edit field only (not to OK or any other button)
2. Capture the keboard input (like ALT, CTRL etc. to be processed diffrently when in the focus is in edit field).
What about handlling WM_CHAR Notification
"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
|
|
|
|
|
Sorry. It doesn't work.
Pani
|
|
|
|
|
pani68 wrote: Sorry. It doesn't work.
No probs, But Dreamz already correctlty answered your question
"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
|
|
|
|
|
Hi,
I use Windows XP.
I created a new desktop named desktop2, switched to it using SwitchDesktop API and created a explorer process there using CreateProcess API.
Everything is fine, but the windows shortcut key is not working in the new desktop. If I use Win+E to get the explorer, explorer opens in the default desktop, not in the new one.
What can I do to get rid of this problem?
Thank you.
- NS -
|
|
|
|
|
I have this code:
DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;<br />
static char BASED_CODE szFilter [] = _T("All Files (*.*)|*.*||");<br />
CFileDialog dlg (false, _T(".*"), _T(""), dwFlags, szFilter, (CWnd *) this, sizeof(OPENFILENAME));<br />
<br />
if (dlg.DoModal() == IDOK) {<br />
}
For some reason, when it reaches the DoModal, it bails without showing a dialog and I used the GetDlgExtendedError function to find out and it throws an error called CDERR_DIALOGFAILURE which says
The dialog box could not be created. The common dialog box function's call to the DialogBox function failed. For example, this error occurs if the common dialog box call specifies an invalid window handle.
I use these same file dialogs elsewhere in the same project and copied and pasted the code and the those dialogs work fine, but this one refuses. I can step through and the window handle is indeed invalid but I don't know why. I'm doing it the exact same here as I am in the other location but it doesn't work here for some reason. Is the problem in front of my face and I am just not seeing what's wrong?
|
|
|
|
|
If you've copied the same code snippet and it works everywhere else, then ponder what's different. The "this" pointer you're passing...is "this" actually a window derivative? The error messsage suggests that this might be the problem, though, it doesn't state it with certainty.
You may want to try a Debug build, linking MFC in a static library, and stepping directly into the CFileDialog code. If I couldn't figure the problem out by analysis, then this is what I'd do. Step through MFC until the error is generated.
Bob Ciora
|
|
|
|
|
You found my error, the troubled code was in my document class which isn't based off of CWnd. I knew I had to have done something wrong since I triggered a debug assertion but I only got that generic error so I didn't know. I'm kicking myself that I didn't calmly examine what was actually different between the two, I was too frustrated with the error to think rationally. I just changed NULL'd the pointer and it works fine, thanks.
|
|
|
|
|
I am using the chat sample program provided with fore systems ATM NIC card to communicate between 2 PCs. I am getting an error 'Cannot open socket'
I debugged and checked the error and found out to be error 10091.
Please help me out to solve this problem.
|
|
|
|
|
I am not doing this type of programing right now, but error lookup (that comes with VC6.0) says "WSAStartup cannot function at this time because the underlying system it uses to provide network services is currently unavailable.
INTP
Every thing is relative...
|
|
|
|
|
Hi guys,
I have a problem.
I would like to make the system menu the menu of my notify icon. The menu comes up but doesn't work. I am doing so that the user can work with the application even if it is hidden and I don't want to create another menu.
Is it possible to do this.
Thanks
Nibu thomas
Nibu thomas.
Software Developer.
|
|
|
|
|
Try this:
// when you recieve the click notification
PostMessage(myhwnd, WM_SYSCOMMAND, 0xF093, yx);
// where myhwnd is the hwnd of your application window and
// yx has the menu x position in the lower word and y in the upper word.
|
|
|
|
|
Simple question: Is it neccessary to release the instance of GraphBuilder everytime you want to render a new file? Or can you merely release the interfaces queried and call RenderFile with the new filename and query the interfaces again?
Thanks.
|
|
|
|
|
I want to create some king of hexadecimal editor and I have trouble converting characters to their decimal values and vice versa. Could someone help me with that or point me into the right direction.
What i want exactly is some function that take a char and tell me it's decimal value like the function asc in vb an one that do the opposite like chr in vb.
I searched a lot and never find some equivalent in c++.
|
|
|
|
|
In fact if you have a char, it is already an int. You can't find anything because it works all by itself. The CString.Format function, the ostringstream or sprintf will all convert a number to a hex string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
samkook wrote: take a char and tell me it's decimal value
char c = 'a';
int i = c;
or
char c = 'a';
CString t;
t.Format("%x", (int)c);
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
There is a hexadecimal editor around here some where (search the articles).
A character is an interger value by default. Yes it may be contained in a single-byte (in english), but it is still an interger. The conversion is just for viewing purposes only and there are functions for doing the conversion.
Writing your own function is easy, if you can not find a compliter specific one..
P.S. Decimal implies that a decimal point is involved (A.K.A. floar, double precision), characters are interger values not decimal valuse.
INTP
Every thing is relative...
|
|
|
|
|
does this still work with wide char?
because I need to display japanese chars and it doesn't seems to work since i get result higher than 65535. But it's true i didn't test it a lot .
|
|
|
|