|
"... so tell us Mr Graus ... what is your impression of the fabled WTL class library and its application to curing world poverty and hunger?"
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
It plainly rocks. I am a little nervous about using it for production code, only because I want to 'know' it a little better before I would entrust a major project to the idea that we won't get half way through and find it won't do something for us easily, but overall I am certainly enjoying learning it and finding it fun to use. Having the message map all in one place is so much easier when you're coding things in yourself rather than using classs wizard. I still don't have the hang of the DDX stuff, I'll attempt that tonight.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Is it possible for you to call LockFile or LockFileEx on the file? What error would it give if not?
|
|
|
|
|
Hi everybody,
I have a problem about WH_SHELL hook. When I use WH_SHELL hook in a dll file (as system-wide hook), it shows a very strange behavior:
Under Win9x/Me, the taskbar does not work correctly. For example, while the program is active, when i start another application, its icon does not appear in the taskbar. When I close my application the icons appear.
At first I think that it is because of my application, however when I downloaded a sample by Frederic Boulanger which also uses WH_SHELL hook, I saw that this strange thing also occurs.
NOTE that everything works fine under Win2000.
Is there anyone who knows the reason of this?
Please help
Best regards
Mustafa Demirhan
|
|
|
|
|
I was wondering if there is a way to find out when an ActiveX control has actually downloaded.
I need to pass a few parameters from my HTML page to my ActiveX, but I am having timing and synchronizing problems. The problems arise from the fact that a lot of times the method calls are made before the object has fully downloaded.
Is there any method or events that I could use to find out whether an ActiveX has downloaded?
thanks
|
|
|
|
|
ok ... this is a klunk but ...
embed an image in the page but don't put its dimensions in the tag ... that causes the browser to show nothing until the image has downloaded totally ... make the image tag after your active x tag and it might give you the time you need to download completely
theres gotta be a better way than this but i did say it was a kludge
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I am having a bad time with a program which I am writing - I wan't to run a DOS based program from my program (Windows). I tried using ShellExecute but the ony thing that happens is that a dos window comes up saying couldn't execute stub or something like that.
Please help, thanks,
James Bird - birdjames@bigfoot.com
|
|
|
|
|
Take a look at CreateProcess(), you might have better luck with this function...
- Anders
|
|
|
|
|
Does the DOS app use a DOS extender, such as DOS4GW? If so, my guess is that the problem is the current directory isn't set right, so the app can't find the DOS extender. Try setting the current dir to the one where the app is, or else use CreateProcess() which takes the dir to use as the current dir as a parameter.
--Mike--
http://home.inreach.com/mdunn/
The preferred snack of 4 out of 5 Lounge readers.
|
|
|
|
|
Anybody has a copy of Sieve of Eratosthenes --- Prime Number generator program.
|
|
|
|
|
Asking people to do your homework is not a long term method of succeeding in the computer industry. How about you post your code and I'm sure we'll all be happy to give advice on where you are stuck.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Thanks to those who helped me previously, my WTL project is progressing nicely (when I find time )....
My latest problem is very odd. I have tried using a number of functions that take an ATL CString, such as GetDlgItemText, GetWindowText ( no prize for guessing what I want to do ) and also GetItemText in my CListCtrl. In EVERY case, I get a message like this:
c:\my programs\wtl\mp3cat\inputdlg.h(52) : error C2664: 'int __thiscall ATL::CWindow::GetDlgItemTextA(int,unsigned short *& ) const' : cannot convert parameter 2 from 'class WTL::CString *' to 'unsigned short *& '
A reference that is not to 'const' cannot be bound to a non-lvalue
I don't see why it's asking me for a pointer to an unsigned short, but it appears an almost universal problem. I've found ways around it in other places ( by doing things differently ) but in this case I have a dialog which has the sole purpose of getting input from a CEdit. I tried fiddling with the DDX sample, but to no avail, and while I'm guessing a bit more time with that might do it, I *hate* DDX anyhow and *never* use it in MFC, so I'd much prefer to get to the bottom of this problem.
FWIW I have the version of ATL in the last SDK ( October from memory )
Thanks to one and all
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Sounds like something's screwy with your ANSI/Unicode settings. GetDlgItemTextA() is expecting an unsigned short* (ie Unicode string) which isn't right.
--Mike--
http://home.inreach.com/mdunn/
The preferred snack of 4 out of 5 Lounge readers.
|
|
|
|
|
*sigh* Thanks - now I know what the problem is. Could it be I need to reinstall WTL ? I haven't #define'd UNICODE anywhere, and in fact doing so breaks a lot of other stuff. I also have tried passing in char*'s, etc., but I keep getting the same messages... I can get this particular code to work by doing this:
char * pChar = new char[255];
::GetDlgItemText(m_hWnd, IDC_EDIT, pChar, 255);
string = pChar;
but I'm still left with the feelings something is fundamentally broken
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Wait, y'know what, I was wrong. You are calling the version of GetDlgItemText() that takes a BSTR&. That's where the unsigned short*& mentioned in the error message is coming from -- BSTR is typedef'ed as unsigned short*
You need to call the other version, which takes an LPTSTR. Note that CString doesn't have an LPTSTR operator - you need to call GetBuffer() to get a non-const pointer.
--Mike--
http://home.inreach.com/mdunn/
The preferred snack of 4 out of 5 Lounge readers.
|
|
|
|
|
I've noticed that BSTR keeps coming up in my list of available inputs and I've been trying to use GetBuffer to get to the LPTSTR version. Why would I not have access to the CString versions ? It appears to be right across the board...
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Calling GetBuffer() returns an LPTSTR. Is this not working for you? The code would be something along these lines...
CString s;
wndSomeWindow.GetDlgItemText ( IDC_SOME_CONTROL, s.GetBuffer(64), 64 );
s.ReleaseBuffer();
--Mike--
http://home.inreach.com/mdunn/
The preferred snack of 4 out of 5 Lounge readers.
|
|
|
|
|
Oh, um... *embarrassed grin*
I thought ReleaseBuffer released the ownership of the pointer, i.e. if I passed the value to a char* or a list on a permanent basis, I would release it from the string. As my wife has been heard to tell me, I've been doing it wrong !!!
So I release after every GetBuffer to restore ownership to the string, is that right ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Yup, this also goes for MFC CString
MSDN says:
"Use ReleaseBuffer to end use of a buffer allocated by GetBuffer."
- Anders
|
|
|
|
|
I think you get it now. When you call GetBuffer(), you get access to the char buffer and you can modify it however you want (as long as you don't overrun the end of the buffer). Calling ReleaseBuffer() means you no longer need this direct access, and the CString object once again becomes responsible for managing the memory associated with the buffer.
--Mike--
http://home.inreach.com/mdunn/
The preferred snack of 4 out of 5 Lounge readers.
|
|
|
|
|
Thanks for the help - all this WTL stuff, combined with trying to read/write ID3 tags, I got a little sidetracked and didn't bother checking out some of the basics. You know what they say - when you make an assumption, you make an ass out of u and umption. ( yeah, it doesn't work, but it's from one of my favourite movies, so I'll quote it anyhow )
Thanks again
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hey all. I'm using GlobalAlloc to allocate memory for a structure. One member of that structure is a 'char *'. I'm using 'malloc' to allocate memory for the string. My question is does GlobalFree free my string, or just the HGLOBAL returned by GlobalAlloc? Or put another way, do I have to call free(m_MyString) before calling GlobalFree?
Thanks in advance for any help.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
Well, yes - you should call free() - GlobalFree() won't know about your char*.
Interesting stuff. malloc on 32 bit systems uses HeapAlloc, I think - the GlobalAlloc / LocalAlloc stuff is 16 bit. The new functions (HeapAlloc et al) can do more in terms of actually creating/managing heaps.
How have you come to use GlobalAlloc?
|
|
|
|
|
Hi Tim. Thanks for the reply. I'm trying to write my own window class. Why? One, so I don't have to link to MFC, and two, so I can study how Windows works from the ground level (using API calls and such). I'm using GlobalAlloc to create a pointer to my window classes 'this' pointer for use in its WndProc. I'd never really tried anything like this before, so when I first noticed GlobalAlloc, it looked like what I needed.
I'll use HeapAlloc instead, since it's 32-bit, and go from there!
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
Visual C++ 6.0, sp5
NT4, sp5
(I also posted this on the ADO board)
I'm working on an app that uses ADO to access an oracle database. The following code is part of the function that opens a recordset (try/catch stuff removed for the sake of brevity):
Fields* m_pFields = NULL;
SAFE_CALL(m_piRecordSet->Open(vSQL, vConnection, adOpenDynamic, adLockOptimistic, adCmdText));
int m_nRecordCount = m_piRecordSet->GetRecordCount();
SAFE_CALL(m_piRecordSet->get_Fields(&m_pFields));
...and this is a code snippet from the function we use to close the recordset:
if (m_pFields)
{
m_pFields->Release();
}
SAFE_CALL(m_piRecordSet->Close());
m_piRecordSet.Release();
m_piRecordSet = NULL;
The problem is with the m_pFields variable.
The first 10 or so times we call the function containing this code, it's a valid pointer. On or about the nth time, the variable is NULL. Actually "not initialized" would be a better description of it's state, because if we don't set it to NULL before calling the get_Fields() function, it's value is 0xcccccccc.
As far as I can tell, we close the recordset when we're done with it. Otherwise, we'd get an error message from Oracle saying we have too many open cursors.
Has anyone got any idea why this might be happening?
|
|
|
|