|
Can anyone point me to a good learing book with lots of samples for programming in windows? I have programmed in C/C++ for some time, self taught, but in the Dos environment and need to get to the Windows environment.
|
|
|
|
|
Can't go wrong with Jeff Prosise's Programming Windows with MFC. Charles Petzold's books are also very good.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I read these two books and I thought they are very helpful for me to understand the algorithms used for Windows programming:
Windows Game Programming for Dummies by Andre LaMothe
SAMS Teach Yourself Visual C++ 6 in 24 Hours by Mickey Williams
|
|
|
|
|
If you are looking to program Windows without MFC then I recommend...
"Win32 Programming"
This could be a good thing because when you do study MFC, you'll know why things are the way they are, which is extremely benificial.
Furthermore, one of the authors is a regular here, so you could also continue to read his stuff by visiting CP.
Barry R. Martin wrote:
I have programmed in C/C++
Good! The book assumes you already know it, so it won't waste your time by telling you how to dereference a pointer, etc.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
<nobr>
Homepage : Sonork = 100.16311 01000010011011110110001000100000011101110110000101110011 00100000011010000110010101110010011001010010111000000000
|
|
|
|
|
Hi all,
I am facing the following problem: If I do a new release of a DLL, I would like to put it on the network, so that other users can access it the next day. Sometimes the users forget to close their programs using the DLL. So they hold a lock on it and the old DLL cannot be replaced by the new one.
Now my question: How do I find out which user on which machine is holding a lock an a file on a network drive? There must be a way to figure that out on Win2k or WinNT. But I couldn't find anything about it in the MSDN or on the internet.
Does anyone have a solution or a hint for me?
Thanks a lot in advance,
Oliver
PS: The only comment from Microsoft I found was: Try again later. But this doesn't quite help. Right?
|
|
|
|
|
I think HandleEx or some similar tool (at e.g. sysinternals) can do it.
|
|
|
|
|
Hi Mike,
thanks for the hint. I have already tried this, but this tool only lists the open handles on the local machine.
Best regards,
Oliver
|
|
|
|
|
this tool only lists the open handles on the local machine.
OK. How about "EnTeHandle" at either CodeGuru or this page?
|
|
|
|
|
This is an interesting site you're pointing me. But it still won't solve the problem, because the processes locking the DLL are not running on the local machine. They're running on other machines connected to the network.
EnTeHandle works somehow like this: MyMachine->AnyHandles->MyFiles. But I am looking for something like this: MyFile->AnyHanldeToItLocatedOnAnyMachine->NameOfTheseMachines.
Best regards,
Oliver
|
|
|
|
|
Ahhh, NOW I get you (and feel like a complete idiot for misunderstanding you so completely - I obviously believed you wanted to program a solution based on the forum).
The solution is simpler than I anticipated!
Have a look at Server Manager (remote connections or whatever it's called - MS changes names for this for every new OS release). It can tell what files are opened by what other remotely connected machines (assuming you're using the MS SMB server here). You can't say what user uses it, but you can both see what machine has it locked, and "kick" that machine so you can replace the DLL.
At least this was available in everything up to and including NT4. In NT5 I think it's in Computer Management under Shared Folders/Open Files.
But if you want to do this using programming you're basickally f***ed. The SMB server is undocumented.
Sorry for my/the confusion.
/Mike
|
|
|
|
|
You could have your program run its own copy of the file on the clients machine. Then have your program automatically check for new version when running and copy the the new DLL's over when available.
Todd Smith
|
|
|
|
|
CRect rect;
int x;
int l;
int y;
BSTR string = NULL;
pPopupMenu.CreatePopupMenu();
GetWindowRect(&rect);
x = rect.right < 0 ? 0 : rect.right;
l = rect.left < 0 ? 0: rect.left;
if ((x-l) > 700)
x = (l+x) / 2;
y = rect.bottom;
CMenu pPopupMenu;
pPopupMenu.CreatePopupMenu();
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option1");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option2");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option3");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option4");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option5");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option6");
iStatus = pPopupMenu.TrackPopupMenu(TPM_RIGHTALIGN | TPM_LEFTBUTTON,
x, y, m_hWnd);
iStatus = pPopupMenu.GetMenuString(1, string, MF_BYPOSITION);
Can someone tell me how to get the the position the cursor is on? I need to get which option was chosen.
Forever ignorant,
Lilian
|
|
|
|
|
You don't really need too keep track of the mouse pointer location. Add a command handler for WM_COMMAND and the selection will be sent there. Of course you'll have to set different IDs to AppendMenu(MF_STRING, WM_OPTION1, "O1") . These IDs will be sent in the WPARAM (?) to your command handler.
|
|
|
|
|
The value of iStatus will be the ID of the selected item, or 0 if he mehu was aborted
so
if (iStatus != 0)
iStatus = pPopupMenu.GetMenuString(iStatus, string, MF_BYCOMMAND);
Should do the trick
You also need to add each item to the menu with a unique ID
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER, L"Option1");
iStatus = pPopupMenu.AppendMenu(MF_STRING, WM_USER+1, L"Option2");
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Thanks for the help, y'all. I got something working using the message handler.
|
|
|
|
|
Does anybody know how to create custom form sizes under Win9x. Under NT based versions of windows you can use the function Win32 API function AddForm().
Also does anybody know the correct way to retrieve the handle to a printer that you pass to AddForm(). At the moment I enumerate the available printers and then open the first one retrieved. This works but it seems like a bit of a bodge. Alternatively you can use AddPrinter() to get a handle but you need to know the name of an installed printer driver eg. Generic / Text Only will only work if already installed on the machine.
Thanks in advance for any help you can give.
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi guys:
We are using COleDataSource for drag&drop between two CTreeView. That's ok.
Problem is multiple selection of items. How can we do this?
Thanx 4 all.
|
|
|
|
|
I'm currently writing a very simple HTML colour highlighting Rich Edit control extension (inheriting from CRichEditCtrl).
The control works perfectly in a debug build, behaving exactly as designed. However, in a release build no colourising takes place.
As a background the following code is used to get a particular line of text from the control to parse it:
CString strLineText;
int nRead = GetLine(nLineIndex, strLineText.GetBuffer(1024));
strLineText.ReleaseBuffer(nRead);
The line index is specified a sa parameter to the function. In the debug build this works fine. But in the release build, for some reason, GetLine returns 0 and strLineText is empty This means that the rest of the code has no text to work on and so nothing is colourised.
In case you were wondering, yes the text is actually there, it's just that GetLine isn't supplying it.
The text has been added using a CString member variable i.e.:
m_strHtml = _T("Some really long html file that runs over several lines");
UpdateData(FALSE);
m_ctrlRichEdit.ParseAllLines();
I have also tried using ReplaceSel , SetWindowText , and I've even tried using the clipboard. All approaches have the same effect.
Any thoughts?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
That is a funny one.
Is your GetLine method overridden? If so, check for obvious things like the method not being wrapped in #ifdef _DEBUG statements. Otherwise, try stepping into the statement (F11) to see exactly whats going on.
Failing that, I dunno, try using EM_GETLINE ??
Dylan Kenneally
London,UK
|
|
|
|
|
I haven't overridden GetLine . The only things it handles are ENM_CHANGE (registered using SetEventMask in PresubclassWindow and OnCreate ) and WM_CHAR .
Whilst trying to debug the problem I added several OutputDebugString calls in the OnChange handler. Bizarely enough if I output the window text in this call, the colourising succeeds becuase GetLine returns the correct text. I tried outputing smaller amounts of text thinking it may be timing related and found that it wouldn't work with anything less than half of the control text.
Even more bizarrely, following on from the timing thoughts, using Sleep or SetTimer to reparse the text after a specified time interval didn't work either. Even waiting for as long as 5 seconds.
It's really weird
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
I did a colorized java editor using a CRichEditCtrl a while back. It is of course just a dirty ol' hack , but if you want to have a look at it I can mail it to you.
|
|
|
|
|
You probably won't want to hear this... but I would advise you not to use the rich edit control for something complex like this (if it's part of a serious product that is).
We based our software product around this control and live to reget it.
It is quite buggy and as it is a part of the OS you don't have total control for distributing it with you App.
|
|
|
|
|
Hi all,
running my application under debug sometimes I receive this message "User Breakpoint called from code at 0x77f9f9df". When I run the application without debug the message is "...unknown software exception (0x0000003) in application at 0x77f9f9df".
The same error occurs when I press F12 running my application under debug.
My environment is Win2000.
Anyone know what it means, there is a solution?! Helpme please!
thanks and sorry for my poor english.
|
|
|
|
|
A 'user breakpoint' is an exception of your application. Probably, your exception should be an inconsistent pointer reference.
Debug your application, and concentrate your attention to your pointer values.
Regards,
---------------------
Pere Llibre
Software Engeneering
|
|
|
|
|
If I try to debug my application the error doesn't occurs!
|
|
|
|