|
Hi,
I use the CRecordset.GetFieldValue to get the last row data. I want to know that is there have any faster way to get last row data
Thanks
|
|
|
|
|
I'm using Visual Studio Express.
I tried to output some data into a text file, I found that the file is encoded in UTF16. The wired part is that non-ASCII characters are in MultiByte encoding (all of them takes two bytes), but the ASCII ones got in UTF16 (which also takes two bytes), and the whole file has a UTF16 BOM.
The file is opened with fopen , and written with fprintf . My strings in my program all all unicode strings, so I had to write like this:
fprintf(" ");
fprintf("%ls", L"UNICODE STRING");
There is some non-ASCII characters in my unicode strings.
I used wide-char version functions in my program explictly, except for file operations (I didn't use wfprintf or wfopen). The charset for the project is set to "No set", and neither UNICODE nor MBCS is defined.
I have set the locale at the begin of main.
And I want to get a MultiByte file, how can get it?
Thanks in advance.
|
|
|
|
|
I would like to know how to detect the movement of Joystick in any windows?
Please help?
|
|
|
|
|
May i know how to use the scrolling control? How do you add it to the custom control to allow a horizontal scroll and also ensure that the squarewave drawn in that custom control is shift appropriately during scrolling. Is there any example on doing so?
Thanks in advance
|
|
|
|
|
cyn8 wrote: May i know how to use the scrolling control?
Your question is not clear!
|
|
|
|
|
I wonder how to periodically obtain and show mem usage in my program.
I think a Timer and thread technique are needed for this purpose. However, I am not sure and clear about this.
Please give me some hints and instructions.
Thanks
|
|
|
|
|
cy163@hotmail.com wrote: I think a Timer and thread technique are needed for this purpose. However, I am not sure and clear about this.
A timer should be okay, but both threads and timer is not a good idea. But timers doesn't give the precision that is required.
|
|
|
|
|
What is the exact acceptable range for creating your own custom command ids for menue items? I was trying to create a dynamic popup menu. Everything worked fine, I created menu item with AddMenu():
AddMenu(MF_ENABLED | MF_STRING, id, "aaa")
my id was the problem. The numbers I was using were conflicting I guess with MFC reserved numbers. I experimented a bit and found that if I used really high numbers, starting at say 400000, it worked. Otherwise I get multiple errors, such as the right id not being returned in the OnCommand() override, or the menu item being greyed.
|
|
|
|
|
|
Look up WM_USER in the help text. This is a #defined constant in the Windows header files that is always equal to the highest Windows message ID. Thus, you can safely define your own IDs starting at WM_USER + 1.
Beware, however, that some Windows common controls use IDs above WM_USER, so what I have done use WM_USER + 1000, + 1001, + 1002, etc., and I have not had any problems.
Scott
|
|
|
|
|
Hi. I am trying to create a pop up loading message. Something like the MessageBox function would do, but no buttons will be visible or enabled until done loading. The app is dialog based. Loading/Done loading will be controled in the main window, and the pop up will be a modal simply to prevent any action from the user in the main window until done loading. Is this possible? Thanks in advance.
|
|
|
|
|
one way is to use a modeless dialog.
::EnableWindow(hwndMain, FALSE);
...create/show modeless status dialog...
...do loading
...destroy modeless status dialog...
::EnableWindow(hwndMain, TRUE);
|
|
|
|
|
I created a new dialog in the resource editor, called IDD_LOADING, and created a new class for it called CLoading.
To create it, I have this code in the main dialog.
EnableWindow(FALSE);
CLoading *pLoadingDlg = new CLoading;
pLoadingDlg->Create(IDD_LOADING,this);
How do I destroy it? Something like this?
CLoading::DestroyWindow();
EnableWindow(TRUE);
|
|
|
|
|
This is what I'd do:
pLoadingDlg->DestroyWindow();
delete pLoadingDlg;
pLoadingDlg = 0;
EnableWindow(TRUE);
|
|
|
|
|
So after implementing the create and destroy loading window, it didn't show up. So I added the line
pLoadingDlg->ShowWindow(SW_SHOW);
Now the window shows up, but when done loading, and the window is destroyed, the focus doesn't return to the main window. How can I fix that? I tried usins popup and overlap style, and it has the same problem. Using the child style, the loading window doesn't even show up.
-- modified at 18:56 Monday 27th November, 2006
|
|
|
|
|
acerunner316 wrote: after implementing the create and destroy loading window, it didn't show up
For the dalog resource: Style should be Child. Set the Visible property to TRUE.
acerunner316 wrote: when done loading, and the window is destroyed, the focus doesn't return to the main window
Try this:
HWND hwndOldForeground = ::GetForegroundWindow();
EnableWindow(FALSE);
CLoading *pLoadingDlg = new CLoading;
pLoadingDlg->Create(IDD_LOADING,this);
...
...
pLoadingDlg->DestroyWindow();
delete pLoadingDlg;
pLoadingDlg = 0;
EnableWindow(TRUE);
if (hwndOldForeground)
{
::SetForegroundWindow(hwndOldForeground);
hwndOldForeground = 0;
}
|
|
|
|
|
Setting the style to child does not work. The popup window does not show up at all. The Visible property is already checked.
The code to SetForeground code does not work. I also tried SetFocus(), but that didn't work either. Any other clever ideas?
|
|
|
|
|
hmmm I tested the code before I posted it.
Are you using the correct parent window when creating the dialog window?
|
|
|
|
|
How do i know if i'm using the correct parent window?
When created the "loading..." dialog window, i just inserted a new dialog in the resource editor. And then opened class wizard to generate a new class for the new dialog. And the rest of the code, you pretty much know already.
|
|
|
|
|
You are passing "this" as the parent. I don't know what class you are creating the dialog in.
For example, if it is a CFrameWnd derived then you may need to pass the client window as the
parent.
pLoadingDlg->Create(IDD_LOADING,this);
By the way, as Scott mentioned, child windows do get disabled when you disable the parent.
This doesn't affect the visiblility of any windows. I disabled the main window in my example to
prevent the user from doing anything until the operation completes, which is the Microsoft
recommended method. Of course, you can do what you want with the UI as you need to.
This does work
Here's the dialog resource I tested with:
IDD_STATUS DIALOGEX 0, 0, 186, 25<br />
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE<br />
EXSTYLE WS_EX_STATICEDGE<br />
FONT 8, "MS Shell Dlg", 400, 0, 0x1<br />
BEGIN<br />
CTEXT "Test Status",IDC_STATIC,15,7,156,12<br />
END
|
|
|
|
|
this is what i have:
pLoadingDlg->Create(IDD_LOADING,this);
IDD_LOADING is configured as Style: child, Border: dialog frame, title bar, visible, tool window.
Is this correct? The Loading dialog still doesn't show up. But the main window is disabled as expected. I can't click anything during the loading time.
|
|
|
|
|
acerunner316 wrote: IDD_LOADING is configured as Style: child, Border: dialog frame, title bar, visible, tool window.
OK for reference, I tested with the same except no title bar and no toolwindow.
What I'm wondering is in this line
pLoadingDlg->Create(IDD_LOADING,this);
What class "this" points to? Where are you calling this from and what class is the window
derived from?
|
|
|
|
|
this is called in a function belonging to the main dialog's class.
|
|
|
|
|
acerunner316 wrote: this is called in a function belonging to the main dialog's class.
and called from what function?
|
|
|
|
|
Called from yet another function belonging to the same class. I only have one class because everything have been in one dialog box until now.
|
|
|
|