|
I've got an MFC aplication (VS6, SP 5) that reads and writes text files using CFile. The applcation was installed on an NT 4.0 box. That box was recently uppgraded to Win2k server. Now a process that use to take a few minutes now takes a few hours!
Are there any "gotchas" I should be aware of when migrating a NT app to Win2k?
TIA
|
|
|
|
|
Some of the way in which the lower level IO is handled for drives, especially SCSI drives, was changed in Windows 2000 Server and later.
Maybe your NT app did something REALLY inefficient like reading 1 byte at a time from the text file off the drive instead of reading a larger block of data into memory and then parsing through that one byte at a time.
If you can control the opening flags for CreateFile, then you can investigate if FILE_FLAG_SEQUENTIAL_SCAN was used as one of the file bufering flags.
In general, I have tailored the CreateFile calls to the activity expected to be performed on each file that is opened, and have not noticed any problems like yours in switching from one system to another.
|
|
|
|
|
Hi All!
I have subclass an edit control and all works fine.
The problem is when the compiling ends I have two warnings:
warning C4312: 'type cast' : conversion from 'LONG' to 'WNDPROC' of greater size.
warning C4311: 'type cast' : pointer truncation from 'LRESULT (__stdcall *)(HWND,UINT,WPARAM,LPARAM)' to 'LONG'.
These warnings are from this code:
OldEditControl = (WNDPROC)SetWindowLong(GetDlgItem(hwnd, IDC_NUM), GWL_WNDPROC, (LONG)EditProc);
The strange is that on Win98 I don't have these warnings.
I have them on WinXP
What's wrong?
|
|
|
|
|
I am using MSVC++ 6.0 and MFC. I need to send message between two applications. I've registered a message via RegisterWindowMessage using the same string in two separate applications. The message has been sent with ::SendMessage(HWND_BROADCAST . . . and BroadcastSystemMessage, but the secnod application is not seeing the message. I can see that the message was sent by watching with Spy++.
I have attempted to watch for the message both through the messaging macro ON_REGISTERED_MESSAGE and by overriding the PreTranslateMessage method on both my view and application classes in the intended recipient.
Can anyone see what I'm doing wrong?
|
|
|
|
|
HWND_BROADCAST broadcasts messages to toplevel windows only, where are you trying to handle the message?
MFC doesn't route non command messages, so if you have a MFC app you will have to catch it in the frame window and not in the doc/view/app etc, then manually route it to the doc/view/app if you wan't to process the message there.
|
|
|
|
|
Thanks. I'll give that a try.
|
|
|
|
|
Is there a reason why the maximum buffer size for a TCHAR seems to be 121 WideChars (for me at least)? Is there a way to increase this size?
Cheers.
|
|
|
|
|
How are you allocating your buffer?
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
I'm declaring this:
_TCHAR temp[4000];
and then using it in a call to this:
int len2 = (int)strlen((char*)testLine)+1;
MultiByteToWideChar(
CP_UTF8,
0,
(char*)testLine,
len2,
(_TCHAR*)temp,
4000);
I've also tried to concat TCHAR onto TCHAR using pointers, but again it stops working when it reaches a size of 121 WideChars.
Thanks for your time,
Tom.
|
|
|
|
|
Does testLine have any /0 characters in it?
How is testLine defined is it a char[]?
I assume your app is being complied as _UNICODE?
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
Does testLine have any /0 characters in it?
No (unfortunately).
How is testLine defined is it a char[]?
char testLine[2000];
I assume your app is being complied as _UNICODE?
It is indeed.....
Cheers,
Tom.
|
|
|
|
|
If you've defined _UNICODE why don't you just use TCHAR's instead of mixing TCHAR's with char's and use the generic text mapping routines (_tcslen() instead of strlen()). If the _UNICODE identifier is found _tcslen() will resolve to wcslen() otherwise it's strlen(). Instead of using MultiByteToWideChar try using mbstowcs() it's simpler.
|
|
|
|
|
Originally I did just that, using all TCHAR's. Unfortunately, it again hit the buffer size of 121 and stopped concatonating.
It concats the whole lot in char's no problem, so I changed to this tactic and then tried to convert - same problem.
|
|
|
|
|
Hi!
Could I show an alternative message when I move the mouse over a button in my Visual C++ application (in a little floating yellow window)? How could I do it?
Thank you in advance
I have no idea
|
|
|
|
|
Interesting.
Try deriving a class from CButton and handle the mouse move message. If it is within the button control's rectangle, then show the message.
Kuphryn
|
|
|
|
|
Do you know how could I show a message in this way? I don't have idea about this.
Thank you!
|
|
|
|
|
|
Thank you, I didn't know its name
|
|
|
|
|
i have cyrillic strings as string constrwints in reesource.
i load it as:
CString str.LoadString(IDS_STRING1);
and the result is {"I?IAA?AE A?OEEOEE"}
any ideas?
were rgrtgrtvrtrt rtrtb brt tyuhjghj hbhbnh hnjm 1234567?
|
|
|
|
|
hummm hummm, what does that mean ?? :p
well, i think you've probably forgotten to specify you were using UNICODE, however, the unexpexcted "I?IAA?AE A?OEEOEE" appears.
am i false?
have a look at TCHAR definition & use...
TOXCCT alias Nicolas C.
|
|
|
|
|
You need to work in a computer with Cyrillic support, for example in Hebrew, or Arabic language.....
Use string type TCHAR
Then Use ::LoadString(HINSTANCE, UINT, LPTSTR, int).....
Best Regards
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
use Unicode (define _UNICODE macro and proper entry point for executable). See MSDN for detailed description
|
|
|
|
|
I am searching for a good way to inform an object which paints into a CView window if the user tries to close the view.
It's very important for me that my paint object first stops its painting and then do an deinitialization before the view can be closed. So I must catch the close event, send an information to the paint object and then send the close message again to the view.
Any good ideas?
Thanks in advance.
|
|
|
|
|
Try adding a handler for OnDestroy() to your view. Call your deinit routine, and then call the base class CView::OnDestroy().
onwards and upwards...
|
|
|
|
|
Hi gurus,
All resides in this simple question:
How to get rights accesses of a shared folder programmatically?
I tried the NetShare* API but the permission value of the PSHARE_INFO_502 structure is not supported on WinXP/2003 (it is said in the doc of the structure). MSDN says to use Authorization API.
Can anyone show me how to retrieve this information? I tried AccessCheck, but it seems complex to initialize.
From a network shared folder, I simply want to check if I can read or write on this shared folder.
Please help!
Thanks!
|
|
|
|