|
If the parent window is a dialog, what happens if you use this...
// Move focus to Next
GetParent()->PostMessage(WM_NEXTDLGCTL, 0, 0);
// Move focus to Previous
GetParent()->PostMessage(WM_NEXTDLGCTL, 1, 0);
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Much better...
And moreover I've seen why this was failing... of course my fault...
I had subclassed two type of controls and one of them was not correctly subclassed.
Thank you for your answer.
|
|
|
|
|
Hi guys..
Pls help,how to i display a text of words on "edit control" when i press a button.
Pls advice.
Thks.
|
|
|
|
|
link a variable to that CEdit, that variable can be a "control variable" or a "value variable", if it is a control variable, you can do something like this:
CEdit m_Sample;
m_Sample.SetWindowText("");
if you prefer to use the value variable you can use that:
Cstring m_Sample = "";
UpdateData(XXXX); => I never remember if here I must use TRUE or FALSE... one of them is the good one...
Hope this helps.
Regards.
PS: in order to make those variables I'm sure that on the dialog you can right click over the control and select add variable or something like this... I've never used VC2003, only VC6 and a little bit 2005...
|
|
|
|
|
I am trying to write an app using MFC which allows me to drag small dialogs around and drop them in static windows. The idea is, the dialogs represent workers and the static windows represent a work position. The problem I am having is when I drop the second dialog in the same static window, it simply overlaps the first dialog so you can't tell there are two dialogs ( or three or four etc.).
I have been using this code to try and detect when the static has a dialog in it:
void CBoxes1Dlg::OnLButtonUp(UINT nFlags, CPoint point) <br />
{<br />
CRect rect;<br />
CWnd *pWnd1;<br />
CPoint pt;<br />
int y=0;<br />
<br />
CWnd *pWnd = ChildWindowFromPoint(point);<br />
if(pWnd!=NULL) {<br />
pWnd->GetWindowRect(rect);<br />
ScreenToClient (rect);<br />
pt.x=rect.left+5;<br />
pt.y=rect.top+5;<br />
pWnd1=pWnd->ChildWindowFromPoint(pt,CWP_ALL);<br />
<br />
if(pWnd1 == pWnd){<br />
}else{<br />
}<br />
}<br />
m_person->SetWindowPos(&CWnd::wndTop,(pt.x),(pt.y),0,0,SWP_NOSIZE|SWP_NOZORDER);<br />
}
This doesn't work properly.....
Anyone see the problem or think of an easier way to do it.
Thanks
|
|
|
|
|
I am using waveIn API to retrieve specific audio device for audio input. I get correct string to identify all audio devices, including USB "webcam". However waveInOpen with WAVE_FORMAT_QUERY parameter set returns "MMSYSERR_BADDEVICEID Specified device identifier is out of range".
Any idea what is wrong here?
I would prefer to stay with waveIn.
Thanks for reading.
|
|
|
|
|
What are you using as a device ID (second param passed to waveInOpen())?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark for reply.
I am passing the int returned from combobox under USB device...
I may be 1 off since it is the last one!
Also - if the combo box is "sorted" how does that match with right device?
Basically it seems weird that waveInOpen will accept item number from combo box.But that what the doc says.
I'll work on it when I get home.
I guess passing query is still not guarantee that I got the capable device.
|
|
|
|
|
For a sorted combobox, the combobox item indexes probably won't match the wave device indexes
(unless they are already in sorted order).
You could use the combobox itemdata to store the device index.
Use the index returned by the CB_ADDSTRING message in a CB_SETITEMDATA, setting the itemdata
to the device index.
Use CB_GETITEMDATA on the selected combobox item to get the chosen device index.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark,
the "problem" was in sorting the combobox.
All legal input devices now work fine.
Only the modem imput line gives an error but I am too tired to find wich one and really dont need it now anyway.
USB is 3rd on the list and not the last when sorted.
Thanks for your help.
Vaclav
|
|
|
|
|
hai all,
i have to solve a small problem and i need help from u people. i have an application where i am using MS Chart. and i am taking values from a file. i need to know how do i plot this values from taking from the file. the values in the file is integers and only one interger in a line.
for example
45
34
36
23
75
so how do plot this value.
chandrasekharan
|
|
|
|
|
Take a look at this article - it has a simple graph function.
http://www.codeproject.com/audio/waveInFFT.asp
|
|
|
|
|
|
hai all,
i have to solve a small problem and i need help from u people. i have an application where i am using MS Chart. and i am taking values from a file. i need to know how do i plao this values from taking from the file. the values in the file is integers and only one interger in a line.
for example
45
34
36
23
75
so how do plot this value.
chandrasekharan
|
|
|
|
|
When performance is not an issue and when all that we want is just a snapshot of the desktop, we can consider the GDI option. This mechanism is based on the simple principle that the desktop is also a window - that is it has a window Handle (HWND) and a device context (DC). If we can get the device context of the desktop to be captured, we can just blit those contents to our application defined device context in the normal way. And getting the device context of the desktop is pretty straightforward if we know its window handle - which can be achieved through the function GetDesktopWindow(). Thus, the steps involved are:
Acquire the Desktop window handle using the function GetDesktopWindow();
Get the DC of the desktop window using the function GetDC();
Create a compatible DC for the Desktop DC and a compatible bitmap to select into that compatible DC. These can be done using CreateCompatibleDC() and CreateCompatibleBitmap(); selecting the bitmap into our DC can be done with SelectObject();
Whenever you are ready to capture the screen, just blit the contents of the Desktop DC into the created compatible DC - that's all - you are done. The compatible bitmap we created now contains the contents of the screen at the moment of the capture.
Do not forget to release the objects when you are done. Memory is precious (for the other applications).
Void CaptureScreen()
{
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC,
nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,
hDesktopDC,0,0,SRCCOPY|CAPTUREBLT);
SaveCapturedBitmap(hCaptureBitmap); //Place holder - Put your code
//here to save the captured image to disk
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
}
In the above code snippet, the function GetSystemMetrics() returns the screen width when used with SM_CXSCREEN, and returns the screen height when called with SM_CYSCREEN. Refer to the accompanying source code for details of how to save the captured bitmap to the disk and how to send it to the clipboard. Its pretty straightforward. The source code implements the above technique for capturing the screen contents at regular intervals, and creates a movie out of the captured image sequences.
In consideration to the above code please let me know how to capture the network PC`s desktop to my software..
I want to capture it continously i dont want to save it, i want it`s Rectangular Area in ma software...
Please let me know how to do this(of course sockets are used) or create a method for this...
|
|
|
|
|
|
HassanKU busted!.Good job Mark.
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Just giving him/her a hard time!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Does anyone have a suggestion as to how to convert a double value to text so it can be displayed in a CEdit window?
Thanks.
John P.
|
|
|
|
|
Since you are using MFC, try:
CString str;
str.Format("%f", 123.45);
m_edit.SetWindowText(str); Or:
char szStr[16];
sprintf(szStr, "%f", 123.45);
m_edit.SetWindowText(szStr);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks, David --- you da man!
John P.
|
|
|
|
|
Since you're usimg MFC, just associate a double variable instead of a string with the windows. DDX will handle the conversions for you.
Judy
|
|
|
|
|
Thanks, Judy. I was not aware of that. That is very useful to know. I appreciate your response.
John P.
|
|
|
|
|
how to display messagebox when click system menu(X) on dialogbox.
Thank to all
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Derive your own class from CDialog and override the OnClose() function which is called by the system when the [X] button is pressed.
|
|
|
|