|
HI all,
i m receiving this error,when i print records with large number of pages like 50 or above.
when i debug the code i m note able to find out this error.
please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi all,
I want to pass a CString variable to my worker thread.
How can i do it...
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Change Allocation to Heap if scope of thread is unknown
pass the TCHAR*.
CString csTemp( "Sample data" );
LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
_tcscpy(lpszData , csTemp)
Величие не Бога может быть недооценена.
|
|
|
|
|
Adam Roderick J 09 wrote: Change Allocation to Heap if scope of thread is unknown
pass the TCHAR*.
CString csTemp( "Sample data" );
LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
_tcscpy(lpszData , csTemp)
While a pointer to the CString object on the heap itself can be passed to the thread, why bother creating a character array on the heap and deal with allocation size manually?
Adam Roderick J 09 wrote: LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
That won't work as expected with Unicode strings.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Rajesh R Subramanian wrote: Adam Roderick J 09 wrote:
LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
That won't work as expected with Unicode strings.
Why not?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: csTemp.GetLength()+1
Because of the +1 part, which makes a wrong assumption of the size of an Unicode character! It could have been multiplied by sizeof(TCHAR) , that would make it work, but is not very clean (IMHO).
There's generally no reason to write C-Style code with manual memory allocation (deciding the size, etc.,) while using MFC, or even C++. Using a CString instead is much more elegant.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I think, there is a small misunderstanding.
for MBCS
LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
Here we are allocating for TCHAR so it will allocate 2 bytes for every new operator.
so if
csTemp = _T("ab" )
size allocation with above allocation will be 4 +2 =6 bytes.
Величие не Бога может быть недооценена.
|
|
|
|
|
Rajesh R Subramanian wrote: Because of the +1 part, which makes a wrong assumption of the size of an Unicode character! It could have been multiplied by sizeof(TCHAR), that would make it work, but is not very clean (IMHO).
Nope:
LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];
Looks correct to me, whatever CString is of wide characters or not.
Rajesh R Subramanian wrote: It could have been multiplied by sizeof(TCHAR)
It is already taken into accout by the new operator.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
For first case the reason is performance, CString is a bit heavy
2.That won't work as expected with Unicode strings.
Why it wont work?
Can you please give me the reason.
Величие не Бога может быть недооценена.
|
|
|
|
|
With #2, my apologies. I overlooked the whole thing.
But I don't think you need optimise for performance by not using CString (C'mon, you're already using MFC). There will be absolutely no usable performance gain.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
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
|
|
|
|