|
Like most people here, I like small, compact and optimized code. Therefore I among other things, I ignore the default libraries when I can, and use a <font color = blue> void main()</font> instead of the default WinMain entrypoint.
I was implemeting ADO as described here[^] in an app, which has such a void main() entry point. After successfully instantiating a ADODB.Connection object, I cannot use any of its functions normally.
pConn->Open(...) causes an unknown exception,
pConn->raw_Open(...) works fine.
pConn->Execute(...) causes an unknown exception, pConn->raw_Execute(...) works fine.
then after changing the void main to the standard WinMain, everything pConn 'behaves' normal.
What is void main() lacking, what WinMain isn't?
Georg Haan, NL
|
|
|
|
|
You're using the #import wrappers, right? Those use _bstr_t which is a MS-provided class that definitely needs the CRT. Not linking with the CRT is causing your troubles.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
in on the recent threads, I've suggested to try doing a callback data supply to my listview control, which I think will be very useful. But I can't figure out how to force the listview to send me the LVN_GETDISPINFO message. I've set the text for each item to LPSTR_CALLBACK and don't have the ASCENDING/DESCENDING styles set. I know this is probably wrong as I figured out it only takes the data in some structure or what. But I need a function. How can I do it?
Thanks very very much
|
|
|
|
|
Hi,
I have a c++ app which posts an XML string to a web site where the data is parsed and inserted into a database. What I need to do is encrypt the XML string before it is sent and decrypt it on the server before it is parsed.
The algorithym needs to be simple so that I can implement it in VBScript on the server but not so simple that it is easy to decipher.
Can anyone make any suggestions?
Cheers
James
|
|
|
|
|
Try this[^]
cheers,
Chris Maunder
|
|
|
|
|
That's absolutely spot on Chris. Thanks loads
Cheers
James
|
|
|
|
|
Hi, I play this game that is DirectX based. It allows you to press Alt+Tab to switch to desktop. At that time the game is minimized, if you press the button in the taskbar the game goes back to fullscreen. When you rightclick the button in the taskbar you get nothing. Now what i want to do is to somehow write a small application so that when the game is minimized i can run some code to make the game maximize in a window(with a caption and all) and so that it doesn't take up the entire screen and i can drag it around. I already tried FindWindow to get the handle and then SetWindowPos() but the game doesn't allow this. What would be the best way to handle this? (and most likely to work)
Many thanks in advance!
Kuniva
--------------------------------------------
|
|
|
|
|
The game probably requires full screen. You may not be able to override that. Check in the DirectX documentation.
Gary R. Wheeler
|
|
|
|
|
Well in my knowledge there's always a way to override things, even if you have to start modifying the directx engine
Thanks anyways
Kuniva
--------------------------------------------
|
|
|
|
|
A directX program must explicitly support windowed mode in order for it to run proprerly. It is possible that your game requires page flipping that is only supported in full-screen exclusive mode, in that case there is no way for you to force it to run in windowed mode.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
In my CMyDocument class I've created a private CObList of some objects. How can I easily get access to this data in a safe way in my View class and dialog, created form my View class? In D.Kruglinski's book there's an example in Chapter 16 but the document there returns a pointer to the private data. But in Deitel's book "C++: How to Program" (Chapter 6.15) the authors do not recommend to return a reference or a pointer to the private data as it destroys the class incapsulation.
Could you give me some piece of advice on this point?
|
|
|
|
|
Add public member functions that set/get the private information. That way, you preserve the encapsulation. The member functions should not return pointers but copies of the objects, so that users of the class can not modify the objects without the class' knowledge.
Gary R. Wheeler
|
|
|
|
|
Thanks for the tip, but how can I return a copy of a CObList object? Wouldn't it be too memory-consuming?
|
|
|
|
|
Hello,
I would like to develop a screen saver creator. There's some articles on the net about program a screen saver. Do you have any idea how to create the screen saver on runtime?
Thanks!
|
|
|
|
|
Hi all,
How can i prevent a restricted user from uninstalling an installed program, say Crystal Reports in a Windows 2000 machine?
With regards
|
|
|
|
|
You probably cannot prevent them from deleting the files, but you can remove the links in the registry to the uninstall program. This would keep the application from appearing in the Control Panel 'Add/Remove Programs' applet.
On Windows 2000, the registry key to look under is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Gary R. Wheeler
|
|
|
|
|
Hi all,
I am writing code on Pocket PC 2002 using EVC mfc. Can anyone tell me how to create a dialog that is not full screen?
Thanks in advance.
|
|
|
|
|
on the PocketPC platforms, CDialog has a member BOOL m_bFullScreen or something like that. In your CMyDialog::OnInitDialog, or constructor, set m_bFullScreen = FALSE;
hth,
Wes
CPUA - # 0xd00d
Sonork ID 100.14017 wtheronjones
|
|
|
|
|
I found out that when you put in a blob manually into Access as an ole object and it says its a bitmap object (in the database field), then an extra 78 bytes of ACcess header info are added at the start of the bmp. So to extract the bmp you chop off the first 78. But now, I have found out how to put in an image by code into Access. this way the field says its a .ong binary data -still an ole object though. However, its got a different header because chopping off 78 bytes doesnt retreive the original bmp. SO the question is, does anyone know the size of the header when its of type .ong binary data? Hopefully its the first n bytes and not embedded somewhere in the middle or after the bmp header info...
Any ideas on how I can get this info?
Thanks,
ns
|
|
|
|
|
Call be a fool and laugh, if y want, but is there a simple way that I can see the elements of a CArray in the MSC++ de bugger?
Ta
Dave.
|
|
|
|
|
If it's anything like a vector, you should be able to drop down the element and get the memory address of your data at least. Then if it's text you can use the memory viewer.
I'll add my obligatory comment on CArray - it's a pile of crap. Consider using std::vector instead.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
and I'll second that, usedthe std container classes vector/list/map etc. free of charge as well i might add.
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
David Carkeet wrote:
Call be a fool and laugh, if y want, but is there a simple way that I can see the elements of a CArray in the MSC++ de bugger?
Yes there is. In the "Watch" window(if you don't see it just right click in the debugger and it will bring up the option), type the name of the array and all the values will be listed. What I do is insert a breakpoint at the place after the array is filled and then start the debugger. Once you have reached the breakpoint type the array's name in the "Watch" window and then presto, your elements will be listed. Hope that helps.
|
|
|
|
|
Well, teach a mangy old dog new tricks. I didn't know the Watch window was that smart!
Thanks!
Gary R. Wheeler
|
|
|
|
|
I had an edit control and I didnt want it, so I replaced it with a richedit, called it the same thing, went into the gray afx areas and commented out the CEdit entry, the wizard had put in a CRichEdit entry. ANd went about my merry way> it devastated the project completely!!!
SO I took a fresh copy, made the old edit control invisible, put in a richedit, called it something else and it works okay.
I see that what I did was not safe.
Is this safe? -->
If i just wanted to get rid of a control and didnt want invisible control clutter in my design view. Could I just cut it out and hope the wizard takes care of it? Of course all references to it (not in the gray afx areas - I learned my lesson) have to be removed. I am extremely nervous about removing anything now and I have a graveyard of invisble controls in my formview...
Thanks,
ns
|
|
|
|