|
dear all,
i am using the following code to get root directory and then find out the file system.
but it gives an error Specified Path iS Invalid!
what wrong have i done!
is there any other (better) way to do it!
plz. help!!!
DWORD dwError;
CString RootPathName;
CString RootDir;
UINT i = GetWindowsDirectory(RootPathName.GetBuffer(MAX_PATH),MAX_PATH);
RootDir= RootPathName.Mid(0,2);
AfxMessageBox(RootDir);
BOOL bFSResult = GetVolumeInformation (RootDir.GetBufferRootDir.GetLength)),
NULL,
0,
NULL,
NULL,
NULL,
FileSystem.GetBuffer(MAX_PATH),
MAX_PATH);
dwError = GetLastError();
AfxMessageBox(FileSystem);
|
|
|
|
|
UINT i = GetWindowsDirectory(RootPathName.GetBuffer(MAX_PATH),MAX_PATH);
RootPathName.ReleaseBuffer();
RootDir= RootPathName.Mid(0,3);
rechi
|
|
|
|
|
This is my code for it : (I don't prefere using CString with APIs and this is just because I feel it's easier to use char)
char WinDir[MAX_PATH];
char Vol[4];
char FileSystem[10];
UINT i = GetWindowsDirectory(WinDir,MAX_PATH);
AfxMessageBox(WinDir);
strncpy(Vol,WinDir,3);
Vol[3]='\0';
AfxMessageBox(Vol);
BOOL bFSResult = GetVolumeInformation (Vol,
NULL,
0,
0,
0,
0,
FileSystem,
10);
AfxMessageBox(FileSystem);
|
|
|
|
|
Hi !
I started yesterday to write my first MDI app (with MFC, let's get at it slowly ). This is a kind of text viewer, maybe editor (Yes, another one but i think it's a good example to start). You may say there is not much to do, but ...
Anyway, my first problem is that i'd like the child windows to be maximized when a document is opened. Currently the child window is about half the size of the screen, in the middle. Since the main frame is maximized at startup, i'd like the child win to be maximized also.
So i intercetpted the CREATESTRUCT from the PreCreateWindow in CMDIChild class, and did :
cs.style|=WS_MAXIMIZE;
But this would not change anything. I tried this in several other places, and also with ShowWindow(WS_MAXIMZED) , but no way, my win is still not maximized. What's wrong ?
~RaGE();
|
|
|
|
|
Try:
ShowWindow(SW_MAXIMIZE);
((CMDIFrameWnd *)AfxGetMainWnd())->RedrawWindow(NULL, NULL,
RDW_INVALIDATE | RDW_ALLCHILDREN);
or MDIMaximize() .
rechi
|
|
|
|
|
Thanks. I'll give it a try.
I did not think it was that complicated : your hint seems a little bit tricky (Do not get me wrong, I just mean that I usually use the AfxGet**() functions when I did not get anything else to work ). Is it possible that the Child Window initially have wrong system metrics (so that it thinks that the maximized size is the size that it actually has on startup, i.e. not the screen size ) ?
[Look at MSDN]
Oh, I think MDIMaximize should be what I need.
Big thanks
~RaGE();
|
|
|
|
|
Rage wrote:
Is it possible that the Child Window initially have wrong system metrics
I don't know.
I have tried to overwrite MyChildFrame::Create and to modify the style before calling CMDIChildWnd::Create but nothing happened. The call to ShowWindow(SW_SHOWMAXIMIZED) - which, by the way, equals MDIMaximize() - remained a must.
But, if you want to do it with a SDI window - 100% API stuff - the metrics work perfectly and are not forgotten. You have to call ShowWindow(SW_SHOW) and the window appears as maximized. This seems to be the natural windows' behaviour - for API SDI, at least.
rechi
|
|
|
|
|
Ok tried yesterday evening. It was really that the Child window had the wrong system metrics for it to work with modifying the style in the CREATESTRUCT of PrecCreateWindow() .
Also tried with MDIMaximize() surprisingly did not work, whereas ShowWindow(SW_SHOWMAXIMIZED) works perfectly (In fact, i can rememeber i tried ShowWindow(SW_SHOWMAXIMIZED) in PreCreateWindow instead of Create before posting my initial thread, and this did not work. Solution was to do it in Create instead.
Well, it works, so lots of thanks for your help anf for you having bothered to try out.
RaGE
Sorry for the pidgin english, it's fast-written.
|
|
|
|
|
Dear All,
Good Day ...
I need to add the scrolling cabapility a propertyPage dailog how can i do that.
Plz help...
Thanks,
Best Regards,
Mohammad Zakarni
|
|
|
|
|
Does anyone of u here know how to create an OLE object in VC++??
Also, anyone have a sample source/project that allow VC++ program to add,delete,edit and search functions?? I need them urgently as i am a newbie to VC++! And are told to do a program interfacing the Microsoft Access database... I had a program that can run add,delete and edit function but i can't get my search function working... do anyone of you have a reference that i can refer to?
Thanks in advance!
Elise
|
|
|
|
|
Why this Code make the System Icon Crazy?
Can you tell me how to solve the problem?
CMainFrame::CMainFrame()
{
bFirst=true;
CShellPidl pidl((UINT)CSIDL_DESKTOP, m_hWnd);
SHFILEINFO sfi;
ZeroMemory(&sfi, sizeof(SHFILEINFO));
HIMAGELIST hSysImageList = (HIMAGELIST) SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)pidl,
0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
theApp.m_smallSystemIcon.Attach(hSysImageList);
ZeroMemory(&sfi, sizeof(SHFILEINFO));
hSysImageList = (HIMAGELIST) SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)pidl,
0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_LARGEICON);
theApp.m_largeSystemIcon.Attach(hSysImageList);
}
CMainFrame::~CMainFrame()
{
theApp.m_smallSystemIcon.Detach();
theApp.m_largeSystemIcon.Detach();
theApp.SalvaListe();
if (m_hLanguageDLL)
FreeLibrary(m_hLanguageDLL);
}
Best regards
Margaria Ivano
|
|
|
|
|
I want to load more that one bitmaps from files, into memory, arrange them vertically and then save the result in a single bmp file. If you know any such sample code or want to give advice then please ???
|
|
|
|
|
Hey all, justtrying to get the item which the user has doubled clicked in a WTL CListview derived class i have. Been looking and trying a few things with no luck. I'm not even sure what message I should be handling, any ideas?
thanks in advance
Luke.
|
|
|
|
|
Hi,
I am a beginner in VC++. Programatically I want to list the services Name & the port No of the service that listeing to .
Like Telnet 23
Smtp 25
http 80 etc.
Can anyone help me to find the solution of this problem?
Thanks in advance
San
|
|
|
|
|
see article
http://www.codeproject.com/system/ppsc.asp#xx207280xx
also theer is a soem code and usefule material at
http://www.15seconds.com/issue/010820.htm...guess your work is done..
this maybe useful for you..
cheers..
Himanshu
|
|
|
|
|
are there any special considerations when i need to have dialog boxes that live inside dll's?
i havnt done this before and i want to know if there are any gotchas?
many thanks
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
|
see article
http://www.mindcracker.com/mindcracker/c_cafe/dll.asp
this may help you.
cheers..
Himanshu
|
|
|
|
|
I'm using softice version 3.2.
I want to set history buffer size to 2048 KB.
I try to set it with that value, and then reboot my machine.
But softice keep the history only about 200 KB.
I don't know why? Can you tell me how to set history buffer size to 2048 KB?
Thanks.
|
|
|
|
|
Back in my BeOS days, I was exposed to a faster mutex implemenation which coupled an atomic_add with a semaphore. The implementation was (in pseudo code):
Mutex constructor:
int_avail_count = 1;
sem_avail_count = 0;
Lock:
atomic_add( &int_avail_count, -1 )
if int_avail_count was 1: return
else (someone else held the mutex): wait on semaphore; for first waiter, sem_avail_count goes to -1
Unlock:
atomic_add( &int_avail_count, 1 )
if int_avail_count was 0: return
else (someone else was or would soon be waiting on the semaphore): release the semaphore; for last waiter, sem_avail_count goes to 0 again
I just encountered a situation in a Win32 app where I have a body of data which must be protected by a critical section, but will be hit often from a high-priority thread. There will be very little if any contention for this data so it's a prime candidate for this construct, which saves a trip into the kernel for a mutex acquisition. I'm therefore looking into using InterlockedIncrement/InterlockedDecrement, CreateEvent/SetEvent/WaitForSingleObject to implement this design for windows. But... On BeOS, mutexes and events were implemented as generic semaphores involving a count. It was perfectly legitimate for a thread to release a semaphore even if it doesn't own it (that was the client's responsibility to enforce). But since ReleaseMutex is documented with: "The ReleaseMutex function fails if the calling thread does not own the mutex object" it requires the use of an event. To use this design on Windows requires an event, not a mutex, and would depend on a behavior, so now the question:
First, if multiple threads are blocked on an event and a single call is made to SetEvent, does one waiting thread unblock, or all? If all, this design is not feasible. If one, on to the next question...
Second, if multiple threads are blocked on an event, and a single call is made to SetEvent, are they released in FIFO order, or arbitrary? Hopefully FIFO, as the design also depends on that behavior.
|
|
|
|
|
Brian Tietz wrote:
First, if multiple threads are blocked on an event and a single call is made to SetEvent, does one waiting thread unblock, or all?
It depends on the type of event. For auto-reset events, only one. For manual-reset, all waiting threads are released. The SetEvent() docs explain it in more detail.
Second, if multiple threads are blocked on an event, and a single call is made to SetEvent, are they released in FIFO order, or arbitrary?
Arbitrary, there is no guarantee on which thread gets woken up.
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Rereading the CreateEvent docs, I do see now the statement about a single thread being released, thanks. In the process I noticed something else that I'd overlooked: that there are semaphore functions at all. With windows I'd only used events and mutexes per se and hadn't noticed semaphores. Switched to the semaphore now, works great.
Thanks,
Brian
|
|
|
|
|
Hello,
I'm trying to arrange more than 100000 items in the listview with icon style. I use ListView_SetItemPosition32 and it works fine for fewers items but having problem to arrange more items. Some items (such as 3xxx - 5xxx) goes to the top of the first item I've inserted (index 0 item) and they got -y position in the view. I've never assign nagitave position value to any item but how come the y came out to be nagitave.
Any idea why? TIA!
thanks!
|
|
|
|
|
Can remember having read something like this in the forum. Can it be that you overflow any item position variable ? Also try to use only unsigned types for item positions in your code.
Hiusing wrote:
more than 100000
Will _really_ someone use this ? Seems quite a lot of data to work with in a listview!
~RaGE();
|
|
|
|
|
With so many items in a list view you should consider to use a
"virtual" list view[^]
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|