|
|
Hi, there,
I added a spin button in my dialog and its name is IDC_SPIN_TAP. Its property is
UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS
I added a class variable CSpinButtonCtrl m_wndSpinTap in the header file. In the cpp file,
<br />
DDX_Text(pDX, IDC_EDIT_TAP, m_nTapNum);<br />
DDV_MinMaxInt(pDX,m_nTapNum,0,100000);<br />
DDX_Control(pDX, IDC_SPIN_TAP, m_wndSpinTap);<br />
......<br />
m_wndSpinTap.SetRange(0,100000);<br />
where IDC_EDIT_TAP is its buddy control. When I clicked the up-arrow of the spin button, the number in the buddy edit window was supposed to increase by one like 0,1, 2, 3.... But strangely, the number becomes 0, -1, -2, -3.... When I clicked the down-arrow of it, the number changed from -3, -2, -1, and stops at zero. How could this happen? Did I miss any setting for the spin button?
Thank you very much!
David
|
|
|
|
|
SetRange() has a maximum range of 32676, use SetRange32() instead.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Yeah, solved. thank you very much!
David
|
|
|
|
|
I have a grid that is populated by a recordset that contains the result of a query. When I have a large database (about 80,000 records and above..) it takes a few minutes to load the grid with all of the records. And I need to make this faster...
What I thought to do is load the data page by page, and display 400 records in each page. So, it would work this way: display 400 records, then display another 400 (800 total), and so on until I reach 78000 records.
But I don't know how to actually implement this...
Do I have to fill the recordset first with 400 records, then with 800 records, then with 1200 records, etc and eventually with 78000? Or maybe I can use a number of recordsets - and if so how do I do this?
|
|
|
|
|
Hi guys,
I am using DirectX functions ( Back Surface - primary surface concept & Blt functions ) for clip image ( 300 image frames, which are continuoulsy displayed one after other ) display in a dialog based application. The problem is that, when the movie frames are displayed in a machine having Martox G400 series card, it is getting better performance, but when the same application is run in a machine having NVIDIA Mx/M2 400 series card, the performance is very low. Please help me, whether any directx related changes has to be made in the source code or how to solve this problem ?
Velayudhan
|
|
|
|
|
|
Hello everyone,
I need to represent long integer (longer than 8 bytes, which can not be represented by C/C++ built-in types). I need to implement add (+) and multiply (*) operations on such data structures efficiently. Does anyone have ideas of how to implement it or any reference materials?
thanks in advance,
George
|
|
|
|
|
George_George wrote: longer than 8 bytes, which can not be represented by C/C++ built-in types
Please have a look at THIS[^]. (I haven't really read it yet, but found it just now.)
Maxwell Chen
|
|
|
|
|
Thank you Maxwell!
It is a very good reference material!
regards,
George
|
|
|
|
|
|
Hi Maxwell,
This class is also very useful. You have so many good materials.
regards,
George
|
|
|
|
|
I am looking for Win32 support.
and i am trying to use GetOpenFileName.
The my code snippet is:
OPENFILENAME ofn;
char szFile[260];
HWND hwnd;
HANDLE hf;
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = (LPWSTR)szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = (LPCWSTR)"All\0*.*\0Text\0*.TXT\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
DWORD err;
if (GetSaveFileName (&ofn)==TRUE)
{
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,0,
(LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);
}
else
err = CommDlgExtendedError();
But i am returned with err = 0xFFFF .i.e.
CDERR_DIALOGFAILURE: 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.
Please help.
|
|
|
|
|
try this
<br />
static char File [260];<br />
OPENFILENAME m_ofn;<br />
memset(&m_ofn, 0, sizeof(m_ofn));<br />
m_ofn.lStructSize = sizeof(OPENFILENAME);<br />
m_ofn.hwndOwner = m_hWnd;<br />
m_ofn.hInstance = AfxGetApp()->m_hInstance;<br />
m_ofn.lpstrFilter = "All files(*.*)\0*.*\0";<br />
m_ofn.lpstrCustomFilter = NULL;<br />
m_ofn.nMaxCustFilter = 0;<br />
m_ofn.nFilterIndex = 0;<br />
m_ofn.lpstrFile = File ;<br />
<br />
m_ofn.nMaxFile = sizeof(File );<br />
m_ofn.lpstrFileTitle = 0;<br />
m_ofn.nMaxFileTitle = 0;<br />
m_ofn.lpstrInitialDir = NULL;<br />
<br />
m_ofn.lpstrTitle = "Save a File";<br />
m_ofn.nFileOffset = 0;<br />
m_ofn.nFileExtension = 0;<br />
m_ofn.lpstrDefExt = NULL;<br />
m_ofn.lCustData = 0;<br />
m_ofn.lpfnHook = NULL;<br />
m_ofn.lpTemplateName = NULL;<br />
<br />
m_ofn.Flags= OFN_HIDEREADONLY|OFN_EXPLORER |OFN_ENABLEHOOK ;<br />
<br />
GetSaveFileName(&m_ofn);<br />
<br />
whitesky
|
|
|
|
|
thanks whitesky....
it does work, with minor changes....
m_ofn.hInstance = AfxGetApp()->m_hInstance;
is not working
m_ofn.lpstrTitle = (LPCWSTR)L"Save a File";
m_ofn.lpstrFile = (LPWSTR)File ;
|
|
|
|
|
In my opinion, possible causes are:
1. Invalid value assigned to hwndOwner member in "ofn.hwndOwner = hwnd ", since hwnd was not initialized before. You must assign a valid window handle, or NULL .
2. Cast expressions like "(LPWSTR)szFile " is incorrect, since szFile is not an Unicode string. You probably did this because your application is compiled in Unicode mode. The recomended way is:
TCHAR szFile[260];
...
ofn.lpstrFile = szFile;
Now it should compile in both ANSI and Unicode mode. (You may need to include TCHAR.h to your file).
3. The assignment ofn.lpstrFilter = (LPCWSTR)"All\0*.*\0Text\0*.TXT\0"; is incorect and must look like this:
ofn.lpstrFilter = _T("All\0*.*\0Text\0*.TXT\0");
which should work in both ANSI and Unicode mode.
4. According to documentation, GetSaveFileName returns non-zero in case of success, which theoretically can be different from TRUE constant. I think it is better to compare with FALSE (zero):
if(GetSaveFileName (&ofn) != FALSE) ...
or simply
if(GetSaveFileName (&ofn)) ...
Hope this will help.
|
|
|
|
|
Want to display the contents (struct contents) in a Notepad when a user clicks a button. The contents of the struct should be transferred to the Notepad without saving in a temp location.
Any clues please
Thanks
Raji
|
|
|
|
|
Use ShellExecute() :
ShellExecute(NULL,NULL,"notepad","c:\\abc.txt","",1);
The above line shows the content of a file abc in notepad.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks. But i don't want to save the file. But need to show the contents of the struct result in a notepad.
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: Thanks. But i don't want to save the file. But need to show the contents of the struct result in a notepad.
Is Notepad is Displayed or you have to display it before displaying the result!
"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
|
|
|
|
|
Notepad is not displayed. Have to display Notepad along with the contents.
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: Notepad is not displayed. Have to display Notepad along with the contents.
this code will help!
::ShellExecute(NULL,"open","notepad.exe",NULL,NULL,SW_SHOWNORMAL);
Sleep(120);
HWND hNoteWnd=::FindWindow("Notepad",NULL);
char *MY="alok";
if(hNoteWnd)
{
HWND hEditWnd=FindWindowEx(hNoteWnd,NULL,"Edit",NULL);
if(hEditWnd)
{
::SendMessage(hEditWnd,WM_SETTEXT,0,(long)MY);
}
}
"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 Re
|
|
|
|
|
Hi ,
Check this out :-
Taken From Jeff Prosise:-
Sometimes the need arises to launch a process and delay just long enough to make sure the process is started and responding to user input. If process A launches process B and process B creates a window, for example, and process A wants to send that window a message, process A might have to wait for a moment after ::CreateProcess returns to give process B time to create a window and begin processing messages. This problem is easily solved with the Win32 ::WaitForInputIdle function:
STARTUPINFO si;
::ZeroMemory (&si, sizeof (STARTUPINFO));
si.cb = sizeof (STARTUPINFO);
PROCESS_INFORMATION pi;
if (::CreateProcess (NULL, _T ("C:\\Windows\\Notepad"), NULL,
NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)) {
::CloseHandle (pi.hThread);
::WaitForInputIdle (pi.hProcess, INFINITE);
// Get B's window handle and send or post a message.
::CloseHandle (pi.hProcess);
}
::WaitForInputIdle suspends the current process until the specified process begins processing messages and empties its message queue. I didn't show the code to find the window handle because there isn't a simple MFC or API function you can call to convert a process handle into a window handle. Instead, you must use ::EnumWindows, ::FindWindow, or a related function to search for the window based on some known characteristic of the owning process.
Regards,
FarPointer
|
|
|
|
|
::ShellExecute(NULL,"open","notepad.exe",NULL,NULL,SW_SHOWNORMAL);
Sleep(120);
HWND hNoteWnd=::FindWindow("Notepad",NULL);
char *MY="Check";
if(hNoteWnd)
{
CWnd* hEditWnd=FindWindowEx(hNoteWnd,NULL,"Edit",NULL);
if(hEditWnd)
{
::SendMessage((HWND)hEditWnd,WM_SETTEXT,0,(long)MY);
}
}
Used the above code. Getting Notepad opened without the contents. Any clues please?
Thanks
Raji
|
|
|
|
|
RajiRaghu wrote: ::ShellExecute(NULL,"open","notepad.exe",NULL,NULL,SW_SHOWNORMAL);
Sleep(120);
Instead of this code, use this code suggested by FarPointer
STARTUPINFO si;
::ZeroMemory (&si, sizeof (STARTUPINFO));
si.cb = sizeof (STARTUPINFO);
PROCESS_INFORMATION pi;
if (::CreateProcess (NULL, _T ("C:\\Windows\\Notepad"), NULL,
NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, π)) {
::CloseHandle (pi.hThread);
::WaitForInputIdle (pi.hProcess, INFINITE);
::CloseHandle (pi.hProcess);
}
"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
|
|
|
|
|