|
Is this okay to do:
m_pCommand->ActiveConnection = m_pConn;
m_pCommand1->ActiveConnection = m_pConn;
So can the active connnection be reused like this?
Thanks,
ns
|
|
|
|
|
I'm pretty sure you can.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Good to know. Thats one less bit of work! I do find that I have trouble reusing the same Recordset object with different commandTexts, so generally end up creating a new rs object for each iunrealted query. For some reason, if I used it the first time with command A, the come back later and try to use it with command B, it crashes.
Thanks for the answers,
ns
|
|
|
|
|
Yes. In fact that it is the way it is supposed to work. An application should really only have one connection object per data source.
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
I am using this code:
int length;
char * buffer;
ifstream is;
is.open (f2, ios::binary );
is.seekg (0, ios::end);
length = is.tellg();
is.seekg (0, ios::beg);
buffer = new char [length];
is.read (buffer,length);
is.close();
buffer[length]=0;
In the above code buffer = new char [length]; buffer is of size [length], and not [length +1] as I've seen in other code. I looked at the doc of tellg() but it doesnt say what this length is, so my question is, is this code correct? Or should I make it [length+1]?
Thanks,
ns
Of course then buffer[length+1] = 0; right?
|
|
|
|
|
I don't see why the string coming out should be null terminated for you, but overall, you should use std::string IMO, and then it will all be done for you. You can read a file using getline and build it into a string.
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
|
|
|
|
|
The length+1 is to account for NUL terminated strings. If you aren't going to treat this data as a string, then you don't need to worry about the extra byte.
Since you are terminating the string with a NUL, then you MUST allocate the space for it.
Tim Smith
"Programmers are always surrounded by complexity; we can not avoid it... If our basic tool, the language in which we design and code our programs, is also complicated, the language itself becomes part of the problem rather that part of the solution."
Hoare - 1980 ACM Turing Award Lecture
|
|
|
|
|
I recently had an issue with a timer that was assigned a value of WM_USER + 200. This introduced an intermittent bug in my document based app whenever the view was refreshed. I found that the value WM_USER+200 conflicted with the CMD_LAST in commdlg.h
<br />
#define CDM_LAST (WM_USER + 200)<br />
I started investigating and found that WM_USER houses messages that are used by dialog controls. According to MSDN:
These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values.
Instead, it implied that WM_APP should be used for app specific event handling. But yet in a lot of examples I've seen they always use WM_USER + X.
I changed my define to WM_APP+2 and it works great! No more phantom bug.
QUESTION: Does anyone have any insight into the difference between WM_USER and WM_APP. What should dictate which is used?
Thanks in advance for any help.
Alan Schneider
BET Inc.
|
|
|
|
|
BeavisInAz wrote:
Does anyone have any insight into the difference between WM_USER and WM_APP.
Yes, don't use WM_USER for your own messages because, as you've seen, the values can collide with values used by the common controls. That's why WM_APP is there, no built-in controls use it.
As for why sample code uses WM_USER - I guess WM_USER is more well-known for whatever reason, and the code writers got lucky and never had bugs related to the message values.
Of course, if you want to guarantee no collisions, use RegisterWindowsMessage() instead.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi Mike
WM_USER values are best used as identifiers and stuff I guess, but not as window messages. I wonder why it still exists. I mean someone should #define WM_USER to WM_APP to make them both equivalent.
I have always encountered issues when I've used WM_USER+x specially when used as tray notify messages, and was curious about why this happened and why this got resolved when I used WM_APP+x. You post reminded me of it
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Hi all,
I tried to user NetShareAdd() to create a network share remotly. I just want one user A to access this share.
but the result is not exactly what I want. The result is the network share was created and shared to this user A. But the security of this share didnot include user A. It just inherited it's parent's security. If that didnot include user A, this share can not be accessed by user A.
So How to do what I want? user A and only user A can access this share???
Thanks a lot for your help.
Code :
--------------------------------------
LookupAccountNameW(
Server,Username,pSid,&cbSid,RefDomain,&cchDomain,&peUse);
InitializeAcl(pDacl, dwAclSize, ACL_REVISION);
AddAccessAllowedAce(pDacl,ACL_REVISION,GENERIC_ALL,pSid);
InitializeSecurityDescriptor(&sd,
SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, pDacl, FALSE);
//setup share info structure //
si502.shi502_netname = (LPTSTR) Sharename;
si502.shi502_type = STYPE_DISKTREE;
si502.shi502_remark = _T("");
si502.shi502_permissions = ACCESS_ALL;
si502.shi502_max_uses =1;
si502.shi502_current_uses = 0;
si502.shi502_path = (LPTSTR) DirectoryToShare;
si502.shi502_passwd = NULL;
si502.shi502_reserved = 0;
si502.shi502_security_descriptor = &sd;
:nas = NetShareAdd((LPTSTR) Server,502,
(LPBYTE)&si502, NULL, );
--------------------------------------
|
|
|
|
|
After installing the Platform SDK rebase.exe suddenly stopped to generate .dbg files. Looking closely, the platform SDK version 5.2.3639.0 does not seem to work, it does nothing!
Any kind of clue is aprecciated
|
|
|
|
|
That is correct. As of version ".NET" Microsoft have removed the possibility to create .DBG files. Actually, they have removed CV (CodeView) creation completely. They seems to think you should switch to their PDB-handling API (which I've never seen documented anywhere, and probably never will since they will with almost 100% certainty change it for every new compiler version).
Basically, you're screwed. Better back down to VC6 again if you need DBG.
|
|
|
|
|
Microsoft does it again !
Thanks for your answer Mike, I guess I better start digging MSDN about that new API you are talking about
|
|
|
|
|
please provide the link of different comprehancive examples of com and com+
and a little help how to run it?
r00d0034@yahoo.com
|
|
|
|
|
http://www.codeproject.com/com/
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
I am running VC++ 6.0 on a WinXP-Home machine. Often a build will hang up (usually while linking). Pressing "stop build" does nothing other than depress the button. I then have to kill the process, open the workspace, and try the build again. This never happened when I was running Win2000-Pro. I have not found any reports of this problem. Has anyone conquered this problem?
Thanks.
|
|
|
|
|
No problems here at all...
I've seen a similar problem with a (unavailable) network path in the LIB environment variable, or in the lib search directories configured in VC.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Daniel:
Thanks for the response.
All of my lib paths (environment var and config'd in vc++) are local and exist.
This problem also happened on another machine in the office (WinXP-Pro). In both cases the problem didn't show up the 1st couple of weeks after the machine was set up, but then slowly got worse.
|
|
|
|
|
Maybe you should clean temporary files?
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Are you running (actually, have you even ever installed - running or not) some anti-virus program? If so, try uninstalling it (just disabling it won't work in many cases).
|
|
|
|
|
This compiled okay when I set
_variant_t abc = "a";
But didnt like it when I tested it like this
if (abc == "a")
also tried
if(!strcmp(abc, "a")
How do I compare a variant? Also, maybe I;m not even allowed to assign it like I did, but it did compile at the assignmentThank you,
ns
|
|
|
|
|
(_bstr_t)abc == "a"
Concussus surgo.
When struck I rise.
|
|
|
|
|
Use the _bstr_t conversion method to get the string back.
if ( (_bstr_t) abc == _bstr_t("a") )
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|