|
Your application currently only has one message pump, and it is busy doing whatever the Start button told it to do. You need to create a secondary thread to do this work, thus leaving the primary thread free to handle the UI stuff. See here and here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I will check it now ... thanx in advance if it will solve the problem
|
|
|
|
|
In addition to the links suggested by David, see this[^] article, specifically the section "Responding to user input while performing a long task".
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You need to use threads;
Simply declare global function in your ...Dlg.cpp file :
UINT Thread (LPVOID pParam)
{
//// Here write your loop
for(...)
{
...
}
return 0;
}
and then add doubleclick on the Start button and add this line of code.
{
...
AfxBeginThread(Thread,0);
...
}
you can also manage this thread by changing abovewritten code with this :
CWinThread * thread = AfxBeginThread(Thread,0);
//if you want to pause this thread then use Suspend() func
thread->Suspend();
//to resume it call
thread->Resume();
Good luck
m0n0
|
|
|
|
|
Thanx guys .. I implemented this working thread (somthing like you suggested) .. but I have one another problem ...
In that working thread I am using UpdateData functions ... and the program compiles prefectly, but when I'm starting it I'm getting ::
Debug Assertion Failure!
File: wincore.cpp
Line: 884
Pressing on ignore button repeats the Assert but in the background I can see that aplication runs well.
So, the question is :: what should I write instead of UpdateData(T/F)???
Just to say that application is Dialog based (so it has only one window)!
|
|
|
|
|
Hi, im working on a Single Sing On system using Visual C 6 SP 5.
I need to use the user32 method AllowSetForegroundWindow, only available in newer versions of user32.lib
There is any way i can update the libs and .h included in VC 6?
Thanks in advance
|
|
|
|
|
Kharfax wrote:
There is any way i can update the libs and .h included in VC 6?
Are you using the newest Visual Studio SP and Platform SDK?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Im actually downloading the SP6 but dont say anything about updating the included libraries.
My platform SDK, im almost sure is really old, but i cant find it to download.
Maybe is this "Windows® Server 2003 SP1 Platform SDK"?
|
|
|
|
|
Yes... Is that, now i should wait to download 400 MB
Thanks
|
|
|
|
|
Kharfax wrote:
Maybe is this "Windows® Server 2003 SP1 Platform SDK"?
Yes. I'm not sure why MS deciced to give it such a name. If connection speed is the issue and you have access to a library with a broadband connection and a CD burner, see if they will let you download it. If you don't want to download it, you can buy the CD. Seems like it is around $10.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
hi, i'm implementing the dijkstra's algorithm. when i complied the .dll file here comes out teh errors:
error C2664: 'TextOutW' : cannot convert parameter 4 from 'char [10]' to 'const unsigned short *'
could anyone help me deal with it?
|
|
|
|
|
Sounds like the dll is being compiled with a UNICODE configuration.
Enclose your string with TEXT() or _T("") and it should work.
This will use the appropriate string type (char or wchar_t) for this function.
I Dream of Absolute Zero
|
|
|
|
|
Hi
How would i write c++ code to make sure that a deep copy
takes place with the following class definition?
class CShop<br />
{<br />
public:<br />
CShop();<br />
~CShop();<br />
<br />
private:<br />
CEmployeeContainer* m_pEmployee;<br />
char* m_strShopName;<br />
};<br />
An explanation will also do rather than code.
Thanks in advance.
Education begins a gentleman,
conversation completes him
|
|
|
|
|
Hello,
Your subject is the answer! Just write a copy constructor that copies all elements of the container and the string..
Example code:
<br />
CShop::CShop(const CShop& ShopToCopy)<br />
{<br />
m_pEmployee = new CEmployeeContainer();<br />
for( CEmployeeContainer::iterator i = ShopToCopy->m_pEmployee->begin(); <br />
i != ShopToCopy->m_pEmployee->end(); i++ )<br />
{<br />
m_pEmployee->insert(i);<br />
}<br />
<br />
m_strShopName = new char[strlen(ShopToCopy->m_strShopName) + 1];<br />
strcpy(m_strShopName, ShopToCopy->m_strShopName);<br />
}<br />
Hope this helps
I also got the blogging virus..[^]
|
|
|
|
|
In addition to Bob's reply, I would suggest replacing the char* member variable with a string or CString type instead. That's one less memory management detail to have to worry about.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok i will, thanks for the help guys much appreciated.
Thanks.
Education begins a gentleman,
conversation completes him
|
|
|
|
|
Hi everybody,
I have several points in an array.
I want to add a code that permits that : if i stop the mouse upon one of this points on the screen show a ToolTip saying which is the order of the array of this point. How can I do it? I know that if instead of stop the mouse; it was doing button-right of the mouse I would have to call ON_WM_RBUTTONDOWN...but in this case? And if once showed the tooltip I move the mouse...how do I make it disappear? I have had a look to the codes already written...but almost all speaks about controls...and I need any point on the screen.
Thanks
Javier
|
|
|
|
|
The WM_MOUSEMOUSE will give you the poit of the mouse. so...
|
|
|
|
|
IS there any limit on the maximum number of controls we can add to a Dialogue box resource in VC++. One of my application needs many controls to be added. But after adding may be around 60-70 controls on that dialogue box, now its not allowing me to add any controls. Please suggest.
Ritheesh V Shetty
|
|
|
|
|
Ritheesh wrote:
IS there any limit on the maximum number of controls we can add to a Dialogue box resource in VC++.
Yes, 255 at design time. If you need more than that, add them at run time.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi experts
In my server side application i have used WSAAsyncSelect() for the purpose of setting it to non blocking mode.
The function executes successfully(returned value is 0) & waits for the client to connect.
Now when i execute my client application, it is able to connect successfully to the server but the server donot receives any notification that the client wants to connect.
Wher am i going wrong.
Waiting for suggestions.
Server side code:
BOOL CDpDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SOCKET server;
WSADATA wsaData;
sockaddr_in local;
WORD wVersionRequested = MAKEWORD(2,2);
int wsaret = WSAStartup(wVersionRequested, &wsaData);
if(wsaret != 0)
AfxMessageBox(_T("WSAStartup() failed!"));
else
{
AfxMessageBox(_T("Winsock version 2.2 dll loaded."));
local.sin_family = AF_INET;
local.sin_addr.s_addr = INADDR_ANY;
local.sin_port = htons((u_short)40000);
server = socket(AF_INET, SOCK_STREAM, 0);
if(server == INVALID_SOCKET)
{
AfxMessageBox(_T("Server socket cud not be created"));
return 0;
}
else
AfxMessageBox(_T("Server socket successfully created at the specified port no."));
if(bind(server,(sockaddr*)&local,sizeof(local))!=0)
{
AfxMessageBox(_T("bind() function has failed"));
return 0;
}
else
AfxMessageBox(_T("bind() function has successfully executed!"));
if(listen(server,2)!=0)
{
AfxMessageBox(_T("Server socket has failed to listen for any incoming connections"));
return 0;
}
if (WSAAsyncSelect(server, m_hWnd, WM_WINSOCK_NOTIFY, FD_READ | FD_WRITE | FD_CONNECT | FD_CLOSE) == SOCKET_ERROR)
AfxMessageBox(_T("WSAAsyncSelect() failed to xecute!"));
else
AfxMessageBox(_T("WSAAsyncSelect() xecuted successfully"));
}
return TRUE; // return TRUE unless you set the focus to a control
}
__________________
|
|
|
|
|
Hi guys
Can any body provide me with any suggestions.
Regards
|
|
|
|
|
hello,
i want to use the apihook to hide a specific file or directory,not let any user to see the file and directory expect me?
what can i do?
|
|
|
|
|
I'm curious what a hook has to do with hiding a file/directory. Just change the security permissions of the object so that only you, or a group to which you belong, can access the object.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all,
this is roland working in S/W Comp. in pune I am doing a project in SDK which is related to desktop in which I also used printer for that i have taken a handle of printer.. i want the o/p as when user selects a perticular area on dektop he should get only that selected area on paper after printing...I am getting print on paper but problem is that print which i get is very small .. i am not getting WYSIWYG effect on paper. the print image gets compressed ...why this happen ? i am tring this from yesterday so plz can anybody help me for this solution.....
i hope i will get sol. from someone
thanking you
Roland
|
|
|
|