|
The variable you pass to the thread should be put on the heap. You could use it from within the thread and delete if it is not needed any more.
UINT ThreadFunc(LPVOID p)
{
CString *pStr = (CString*)p;
return FALSE;
}
CMyDlg::SpawnThread()
{
CString *pSz = new CString(_T("Some value"));
AfxBeginThread(ThreadFunc, pSz);
}
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Hi,
I am using TIdFTP component from the c++ builder to upload the file on to the ftp. It works fine for small files but when I upload the file like 4GB then it upload only 700 mb almost, then terminate. So Please tell me how upload larger files using TIdFTP.
|
|
|
|
|
I am using a MDI application. In the main window there need to be two panes, left pane and the right pane. The left pane displays some static information which will not change at all. But the right pane needs to display dynamic information which will get updated at frequent intervals of time.
I placed a modeless dialog after removing the minimise, maximize and close button from the top on the right pane using the SetWindowPos() which showed the data and gets updated at frequent intervals of time. So i was able to open other dialog windows in the application by this setup.
The Problem is when I use the "Restore down" button of the parent window, the parent window and the dialog window gets separated and shown. Also the parent window becomes resized in size(became a small window) whereas the modeless dialog window remain the same.
Now what I want is a separate pane window, in the mainwindow which should be minimized according to the main window and should remain in the same position in the parent window.
Please provide me sample code for this.
|
|
|
|
|
The dialog is not 'attached' to the MDI frame in the same way that a view would be, so you will need to hide and restore it manually when the parent changes. I think the only way to get this to happen automatically is to use a window that derives from CView() , and is correctly attached to the frame window.
|
|
|
|
|
i am displaying a rich edit control in an mdi application. during which i want to disable my keyboard accelerators to avoid the unnecessary commands invocation as a result.
once i finish working with the edit control, i want to enable them again.
would like to know the way if any.
thanks
|
|
|
|
|
Please check DestroyAcceleratorTable[^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Is there an equivalent function to FindFirstChangeNotification that works across a home network ?
Doug
|
|
|
|
|
hmmmm - how do you mean
DougButtimer wrote: across a home network
In general, iirc, FindFirstChangeNotification can only be used on a local PC and cant even be used to watch net shares. Any time Ive needed to 'achieve similar' across a network Ive used ftp to list a directory at time-0 'initial snapshiot', then compared that to ftp lists at time+n where n is 'polled'/refreshed at desired intervals - eg 5 or 15 minutes
sorry, likely doesnt help much
'g'
|
|
|
|
|
Hi Garth, Just after I had made this posting, I realised that I'd hit this problem once before and hadn't found a solution then either, so your reply wasn't unexpected ! Yes, I think that I'll have to resort to some solution along your lines ! Thanks, and a very happy Christmas to you !
Doug
|
|
|
|
|
I thought of 2 possibilities 'a bit better' than comparing ftp listings
Both really depend on how many files/events you are looking for - one might work for instance with creation of a particular file or a 'low volume' change system than the other - what about :-
1) use FindFirstChangeNotification on the machine you are watching, but add the [possibly filtered] events to a log file ... everytime you ftp from the 'monitoring machine', you grab the log file and erase it
2) use a tcp pub/sub system, the monitored machine publishes [again, possibly filtered] events from FindFirstChangeNotification to subscriber(s) - the monitor machine(s) 'subscribe' to particular events composing of {source machine name, add/change/delete, file(s)} for example - a lot more work, but extensible and applicable to multiple machines you might want to monitor from
not much I know
'g'
|
|
|
|
|
|
Garth, Unfortunately, being a novice, I'm not "in to" Net Framework !! Thanks for your research, nevertheless
Doug
|
|
|
|
|
|
Hi Garth, I think that the real problem is that the folder that I want to watch is on a NAS disk and so the "This code will only work on Windows NT, Windows 2000, or Windows XP, and the directory you wish to watch must also reside on a WindowsNT, Windows 2000, or Windows XP computer" is going to make it a non-starter. I've now implemented a polling _findfirst/_findnext strategy which, although a bit basic, works fine !! (Just hope that the NAS disk can stand the traffic !!) Many thanks for your determination to find me a solution !!! Cheers !
Doug
|
|
|
|
|
Hi,
I have a graphic application (2D editor) compiled on US Windows Vista (using Borland compiler). If I use default mapping mode (MM_TEXT) it works OK in all versions of Windows. However, if I use other mapping modes (MM_HIMETRIC - which changes y axis orientation and my code reflects this) the graphics are not visible in European version of Windows (German, Czech). I have read somewhere that European version of Windows have opposite axis orientation in other than default mapping mode.
If you know how to deal with this problem I would appreciate your time and help.
Thanks,
Denny101
|
|
|
|
|
I didn't know about that, I thought it should be "standard", but... one possibility could be to get the version of windows and adapting your coordinates to the differences.
I use German Windows, by printing or previewing I use:
pDC->SetMapMode (MM_LOMETRIC);
pDC->TextOut (pInfo->m_rectDraw.left, 50 - pInfo->m_rectDraw.bottom, pDoc->GetPathName());
With this I print the path of the file at the bottom of the page.
You say the Y orientation changes between countries, then my
50 - pInfo->m_rectDraw.bottom should change and be pInfo->m_rectDraw.bottom - 50 for US, shouldn't it?
the result is just the change of the sign, at german version will be -X and at US will be X
A way to do it could be getting the version of windows and adapting the +/- to it. So you can get the version of windows (sorry but I don't know how to for sure) at the initialization of the program in BOOL CMyApp::InitInstance() and say:
if ((windows == US) || )
iFactor = 1;
else
iFactor = -1;
and afterwards
pDC->SetMapMode (MM_LOMETRIC);
pDC->TextOut (pInfo->m_rectDraw.left, iFactor(pInfo->m_rectDraw.bottom - 50), pDoc->GetPathName());
Using as coordinates with Y positive to go down, and that would adapt the sign, according to the windows version.
I guess there is a better approach, but this is an idea.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks Nelek for your help. After some more testing I think the problem is not in the axis orientation but in the screen refreshing. I used a different component for drawing than in my previous programs and it needs a different method of refreshing. I will post the result when I know where the issue was.
All the best,
Denny101
|
|
|
|
|
You are welcome
[quote]
I will post the result when I know where the issue was.
[/quote]
Please do it. I am curious about.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi,
I found the problem with my program running on European Windows - it is in the decimal separator! European use comma, while the US (and all English countries) use dot. My program reads a file with coordinates in a string format. I use Borland Builder C++ and I trusted it that its method AnsiString::ToDouble() makes the conversion according to the OS used - but it does not. After I changed the conversion method to STL C++ strtod() it works fine on all systems.
Regards,
Denny
|
|
|
|
|
Glad you found the solution.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Upon a cold start, I create an fstream replay file that's opened for output ios::out. If my program stops and does a warm restart, I open the file for ios::in and process the file. Then I close it and reopen it as ios::out | ios::app. This second open succeeds if did not read (getline) any data when opened for ios::in; but fails if I did read data. I thought that flushing the file before closing might have helped, but it didn't. This is not the kind of behavior I, for one would've expected. Any ideas or suggestions?
Thanks
|
|
|
|
|
You can check the stream state for all operations open/create/write you are doing. May be the file is empty while you are opening it?
Checking documentation for fstream may help you..
--
"Programming is an art that fights back!"
|
|
|
|
|
When selecting a different item in my combobox control, I need to save some dialog information for the previously selected item. Which combobox notification should I use for this purpose and how?
Thanks
--
"Programming is an art that fights back!"
|
|
|
|
|
From MSDN:
ON_CBN_SELCHANGE The selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. When processing this message, the text in the edit control of the combo box can only be retrieved via GetLBText or another similar function. GetWindowText cannot be used.
|
|
|
|
|
Hello, folks,
I set a file association programmically. point the DefaultIcon key value to a .ico file. but after my setting operation. the icon is not be shown with the associated file. but, i noticed that the msi installer can refresh the explore and enable the associated icon with files after installing?
How to enable the setting immediately? what API should i call?
Thanks,
hawk
|
|
|
|