|
vividtang wrote:
i want to use GetWindowsDirectory to get the windows paths...
char szBuffer[MAX_PATH];
GetWindowsDirectory(szBuffer, sizeof(szBuffer)); vividtang wrote:
...but my end aim to get notepad.exe path,so i want to know how to combine them to satisfy my final aim.
There is no guarantee that notepad.exe exists in any particular directory.
vividtang wrote:
in addition, i want to call painter paths
What are "painter paths?"
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
the program is to display NotePad ICON on the left up corner in window.
void CSampleView:
OnDraw(CDC * pDC)
{UINT stFileInfo;
if( :: SHGetFileInfo(_T("c:\\windows\\notepad.exe"),0,
&stFileInfo,sizeof(stFileInfo),SHGFI_ICON))
{
pDC ->DrawIcon(10,10,stFileInfo.hIcon)
}
}
BUT COMPILE ERROR:
arning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
F:\control learing\517evening\517eveningView.cpp(61) : error C2664: 'SHGetFileInfoA' : cannot convert parameter 3 from 'unsigned int *' to 'struct _SHFILEINFOA *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
F:\control learing\517evening\517eveningView.cpp(63) : error C2228: left of '.DisplayName' must have class/struct/union type
Error executing cl.exe.
517evening.exe - 2 error(s), 1 warning(s)
|
|
|
|
|
Change
UINT stFileInfo;
to
SHFILEINFO stFileInfo;
Bikram Singh
|
|
|
|
|
hi:chopchop,thx your kindness
but when i changed ,the following error:
warning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
F:\control learing\517evening\517eveningView.cpp(63) : error C2039: 'DisplayName' : is not a member of '_SHFILEINFOA'
c:\program files\microsoft visual studio\vc98\include\shellapi.h(570) : see declaration of '_SHFILEINFOA'
|
|
|
|
|
You should do a bit more work and look it up in MSDN...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/structures/shfileinfo.asp
Anyway, the member is not DisplayName, rather it is szDisplayName
Bikram Singh
|
|
|
|
|
SHFILEINFO stFileInfo;
if(::SHGetFileInfo(_T("c:\\windows\\notepad.exe"),0,&stFileInfo,sizeof(stFileInfo),SHGFI_ICON))
{
pDC->DrawIcon(40,10,stFileInfo.hIcon );
}
ALL OK,THX
REGARDS
|
|
|
|
|
hi i added a list view control made it report style and mapped a variable list view variable to it in mfc
now when i go to add a column it wont cooperate
i tried m_List.InsertColumn(0, "Hello");
and sometimes itll do nothing other times itll do a sliver of a column with nothing in it
what is the proper way to set up columns?
thanks
|
|
|
|
|
The column has probably been added, but its width is too small. Change the call to this to verify:
m_List.InsertColumn(0, "Hello", LVCFMT_LEFT, 100);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
lol yeah i figured it out i accidently had the code after a return how stupid is that rofl thanks for helping out tho
|
|
|
|
|
Hi,
I'd like to browse a large text file (more than 100 Mbytes) to extract some information.
With standard File access method, my hard drive is overloaded by access request so that my treatment is very long.
What is the correct method to do that?
Thanks,
Regards
|
|
|
|
|
vflouriot wrote:
With standard File access method
What do you mean? fgets() ?
One way would be to use fread() with a "decent" buffer size of say, 32768 bytes. However, you would have to parse this buffer in order to read the data "line by line" i.e. detecting CRLF's.
Bikram Singh
|
|
|
|
|
If you are doing a one pass search, just read in chunks in, say, 32k increments [larger won't buy you anything].
If you are doing a multi-pass search, use memory mapped files.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Tanks for all the reply
I actually use std::getline with the default buffer size.
Could you please explain why reading in chunk will provide better result than mapped files for single pass threatments ?
By memory mapped files, you mean overlapped I/Os ?
Thanks,
VF
|
|
|
|
|
Memory mapped files just leverage the demand paging mechanism built into Win32. Demand paging does take some CPU time. Since all the pages would be paged in, you'll get a slight performance increase if you read the data in in chunks.
If, on the other hand, your data has some organization to it such that you won't need to read all the pages in, a memory mapped file may give you increased performance.
Memory mapped files are different than overlapped I/O which is innappropriate in this situation.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Ok,
I tryed to use the memory mapping service this morning, at it works fine.
Do you know what function should I used to extract each lines of the text file ?
I mean, Do you know a usefull built-in function to parse a text file line by line when you just have a pointer on the beginning of the file
Thanks again,
Vince
|
|
|
|
|
Just brute force parsing.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
How to change the backgound color of a dialog?
The function SetDialogBkColor() is obsolete, so it cannot be used.
|
|
|
|
|
hey:i can give you some little help
HBRUSH CMyTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{if (nCtlColor = CTLCOLOR_STATIC ) {
pDC->SetBkColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
HBRUSH B = CreateSolidBrush(RGB(255,255,0));
return (HBRUSH) B;} }
running ok
|
|
|
|
|
I suppose that this code changes the bkg color of controls. However, I need to change the bkg color of a dialog window.
|
|
|
|
|
Thanx, I tried the code and it works. When I first looked at it I thought it was for controls, but when I tried it worked.
|
|
|
|
|
hi
how can i open serial & parallel ports in win NT\XP
where _inp & _outp functions works only in win me
thanks
|
|
|
|
|
|
I have already gone through those messages to no avail, i have even tried passing keyboard values direct to the OnChar method of the CDateTime Control but when i pass them from the button presses, eg press one and send the appropriate stuff via OnChar it will not update, however via a normal keypress it does update. I am beginning to wonder if the CDateTimeCtrl is a bit of a 'funny' class unless you use it exactly in the way microsoft want you to!
|
|
|
|
|
Just like LoadLibrary.
Help me plz...
|
|
|
|
|
What do you want to do exactly?
What function do you need?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|