|
UI frozen=Sleep worked... like it was suggested, create a loading thread and have that thread message back to the original thread when he's done. Using Sleep() in this manner is not acceptable, you're freezing the user interface on purpose, many do it on accident, but on purpose!?
|
|
|
|
|
So does that means using Sleep() (in main thread) in mfc in condemned??? I never realized that. I think a lighter way was what I did (activated a timer and went to sleep there). Thread is also a good option. Thanks for the reply.
|
|
|
|
|
It's condemned to use Sleep()(for this length of time) in UI thread(its common for people to separate the UI from the rest of the code).
|
|
|
|
|
How do i find last created file in a specified directory?
|
|
|
|
|
Enumerate the files using FindFirstFile & FindNextFile. Using WIN32_FIND_DATA compare the properties and time stamps or whatever is required. You will need to compare the file creation times using an algorithm
FILETIME ftCreationTime; will be of interest in your case.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
|
Hi ,
I have used the following code to send Message to a vb window,
While using this code in win32 application i can able to find the child window and no problem with my code,
But while using this in an mfc application cant able to find the child window and
it is always null.
Please help to solve my problem,
Thanks in advance.
HWND FormhWnd;
long uClickYes;
long Res ;
long lngresult;
UINT sendtxtmsg;
sendtxtmsg = RegisterWindowMessage("SEND.TEXT.MSG");
LPCSTR strCaption ;
LPCSTR strClass ;
LPCSTR TextBoxCaption ;
strCaption = "WINDOWNAME";
strClass = "ThunderRT6TextBox";
TextBoxCaption = "";
FormhWnd = ::FindWindow(NULL, "WINDOWNAME");
CString txtval;
txtval.Format("%d",sendtxtmsg);
if (FormhWnd != NULL)
{
HWND findchild;
AfxMessageBox("FormhWnd not null");
findchild = FindWindowEx(FormhWnd, NULL, strClass, NULL);
if (findchild != NULL)
{
AfxMessageBox("findchild not null");
FILE *fp;
fp=fopen("sendmsg.txt","w");
fputs("joined Channel..",fp);
fclose(fp);
Res = ::SendMessage(findchild, sendtxtmsg, 1,0);
}
else
{
AfxMessageBox("findchild null");
}
else
{
AfxMessageBox ("PARENT WINDOW NULL");
}
nick
|
|
|
|
|
You should check the results of
GetLastError() after each API call to try and determine why your code is failing.
The best things in life are not things.
|
|
|
|
|
Is the child window you're trying to find a CEdit?
|
|
|
|
|
hi,
thanks for ur reply,
i am trying to find a edit control in vb application,
i used the same coding in not using mfc application
in that i can able to find the child window ie., edit control (vb)
but in mfc i cant able to get the child window.
thanks in advance,
chithra
nick
|
|
|
|
|
Hi all,
I have made a CString variable in that variable i have a single character value like A,B,C.....
I want to put this value in simple char variable(not into char* or char[]).
How can i do so????
thanks in advance
|
|
|
|
|
|
CString can be compiled in UNICODE or NON-UNICODE mode.
In NON-UNICODE mode, the underlying data type is a char .
But in UNICODE mode, the underlying data type is a wchar_t .
So in UNICODE mode, you may not be able to directly assign a single character to a char variable using the GetAt function or []operator .
Here is something you can do so that it works in both UNICODE and NON-UNICODE builds -
CString str("Hello World");
CStringA stra(str);
char C = stra[6];
|
|
|
|
|
Use CString::GetAt() and pass it ti WCHAR or TCHAR - whar ever you are comfertable with...
---
CHEERS!!!
|
|
|
|
|
Hi,
I have one linux cpp executable file. i want how to run this executable file in windows OS?.
please give any idea? or urls
Regards,
M.Mathivanan
|
|
|
|
|
You can use cygwin ( http://www.cygwin.com/ ) on windows. While installing the cygwin you need to select the packages you want to install in cygwin some of the packages are gcc, vim editor, some library.
|
|
|
|
|
|
mathivanaan wrote: I have one linux cpp executable file.
Is it an uncompiled cpp file, or an executable created using c++? You cannot execute a cpp file.
|
|
|
|
|
I have made some important changes to the VC tool box and I can find nowhere to save the changes.
Is it possible to save the changes? such as locate the file ,save it, then after the vc's reinstallation, recover the file so that I can access the changes I have made to the tool box?
|
|
|
|
|
Try saving the files in the folder C:\Users\<user name>\Documents\Visual Studio 2010\Settings .
I'm not sure if this file includes the toolbox settings.
|
|
|
|
|
It's amzing. I've found the data in that settings file. Thanks.
|
|
|
|
|
Hi all,
i working on dialog box application ,here the main dialog box have some buttons and some other controls,
on clicking on on buttong any other child dilaog box is open ,when any child dialog box is open main dialog box is not accessible,
but in my case at certain point on dialog is open by running thread over the main dialog box,and when this is open he main dialog is accessible when one child dialog box is open over it, and oter buttond and dialog box also working on this condition,
i m using EnableWindow(0) for main dialog when open the child dialog box from thread but its not working.
please help me how can i solve this.
i want when any child dialog is open over the main dialog box the main dialog sholud not be accessible.
thanks in advance.
|
|
|
|
|
Simply make the child dialog a modal dialog.
This way the parent dialog will become inaccessible when the child dialog is visible.
If using MFC, call the DoModal method to display a modal child dialog.
If not using MFC, call the DialogBox API to display a modal child dialog.
|
|
|
|
|
Le@rner wrote: when any child dialog box is open main dialog box is not accessible,
That is as it should be. If you want to be able to access the parent, then you need to make the child dialogs modeless.
The best things in life are not things.
|
|
|
|
|
You can make a modeless dialog by API CreateDialog, which when open giveS you the ability to access both the parent window and child dialog box.
|
|
|
|