|
Couldn't he also use a SAFEARRAY of characters? That would preclude him from having to convert characters, and what if there's actually zero's in the blob of data?
I'm certainly no COM expert (far from it actually), but it seems a SAFEARRAY would be, ummm, safer.
|
|
|
|
|
awwwww ... where's the fun in that
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I think he's past the "having fun" part...
|
|
|
|
|
Addressed below is a subset of your problem. Essentially, first, you are getting a byte array data typecast to char* and hence the trouble.
0. Use BT_BYREF|VT_UI1 *and* pbVal.
I bet this will work because VT_BYREF|VT_I1 maps to char*. (Meaning, a C-String to be ended at the first null character).
1. For another clean solution. (Divide the work between you and the dll guy):
- HGLOBAL hG = GlobalAlloc( GPTR, 192 );
- CreateStreamOnHGlobal gives you a pStream
- Use CComVariant::ReadFromStream
- Release pStream and hG correctly, later.
2. Or, you can hack like this:
::SysAllocByteLen(192 bytes) to allocate a BSTR yourself.
memcpy your data into BSTR
Encapsulate this BSTR into CComVariant.
Release SysFreeString the BSTR later
I think solution 0 above should solve your problem completely. If not, try 1. If 1 doesn't work, 2. also will not work, and it will be time to focus on ADO/Access interaction rather than CComVariant.
But, if ADO/Access is graceful enough about string lengths and all, I am betting, it's just the issue of data types, and solution 0 will take care of it.
-------
Nature, to be commanded, must be obeyed. (Francis Bacon)
Nature, to be apprehended, must be obeyed. (Ayn Rand)
|
|
|
|
|
On second thoughts...
Solution 2. above may not be suitable at all. Here's why. ADO/Access may not like a VARIANT of BSTR type for updates to a binary field in the DB. (Just check up about what data types it can take for TEXT, MEMO, etc. field types.)
-------
Nature, to be commanded, must be obeyed. (Francis Bacon)
Nature, to be apprehended, must be obeyed. (Ayn Rand)
|
|
|
|
|
Thank u very much Ajith for prompt reply. I will all the solutions.And inform u the result .Thanks once again.
K.G.RajaShekar
|
|
|
|
|
Hi All,
I am working with VC++(ATL COM AppWizard).How can I trim the leading and trailing spaces in a BSTR value ?
Thanx in advance for help !
Y.Yamini Devi .
|
|
|
|
|
hello,
im using winrunner to test an app and it is failing to find text in a list box when the fields are becomeing truncated. I wanted to overcome this by calling api functions to find the x y coordinates of focus rectangle as the desired item in the list has already been selected using the apps search function. With these i could move the mouse to those coordinates and continue the test.
Ive tried the following:
***********************************************************************************************
HWND Handel, ChildHandel; //Handels
POINT Pos;
Handel = FindWindow (NULL, "Fields"); //Get fields Window handel
ChildHandel = FindWindowEx (Handel, NULL, "STRHList", NULL); //Get List window
SetForegroundWindow(ChildHandel);
GetCaretPos (&Pos);
printf ("%d\n\n", Pos.x);
***********************************************************************************************
This prints out 0.
Is there any api function that will give my screen coordinates for the focus rectangle or the currently selected item in a list???
|
|
|
|
|
GetWindowRect ? What are you trying to do ? Did you copy and paste this code, and if so, I'm curious as to how your compiler accepts handel ?
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
By George I think he must have the classic version of the compiler!!!
|
|
|
|
|
Im trying to find the coordinates for a selected item in a list. The code i wrote there finds the handel for the list then sets it to the foreground. Then i try to get the caret position. As far as i know the focus rectangle is an invisible caret??? This code compiles and runs but obviously isnt giving me what i need. Im using visual C++ 6 is this a bad thing?
|
|
|
|
|
>Im trying to find the coordinates for a selected item in a list. The code i wrote there finds the handel for the list
> then sets it to the foreground. Then i try to get the caret position. As far as i know the focus rectangle is an
> invisible caret??? This code compiles and runs but obviously isnt giving me what i need. Im using visual C++ 6 is this
> a bad thing?
I'm at a loss to get what you're going to *do* with these co-ordinates. If you have a handle to the window, you can use GetWindowRect, like I said, but I'm not sure where you are headed,
VC++6 is fine, at least I hope so ( I use it for 10-16 hours a day )
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
lol ok i thought maby i could blame it on an old compiler.
I want to call this in a dll from winrunner and then use the co-ordinates to move the mouse above the field so i can drag and drop. There is a click on text function that works as long as the text isnt truncated and the rest ive got sorted. Obviously im not a developer but in testing ive done some simpler api calls succesfully, but this is a tough one.
Will GetWindowRect will give me the co-ords of the field list?? or the co-ords of the selected item? I need the latter which is why i started trying to find the focus rectangle in the first place or maby there is a way to find the hilite??
well out of my depth here
Will finding the caret give me the position of the input focus rectangle or is there a way GetWindowRect will do it???
Thanks for trying to understand what im on about
|
|
|
|
|
A minor point - you're misspelling the word "Handle".
In code I'm working on now, someone misspelled the word "Delimiter" as "Delimeter". We all know that a deli-meter is a unit of (length) measurment commonly used in restaraunts that produce submarine sandwiches, and is the overall length of a deli sandwich after it is disassembled and its components are laid end-to-end. When converted to standard measurements, it equals to about 33-1/2 inches.
|
|
|
|
|
How would I open a connection to an FTP server such that I could send actual
commands to the server (ex: LIST, etc) and view the actual responses the
server gives (Welcome messages, etc).
I know how to use the CFtpConnection to do basic FTP stuff, but I don't
think it does this.
Anyone have any ideas?
Adam
cabadam@houston.rr.com
|
|
|
|
|
ummmm you could just open a socket @ port 21 and send the commands thru as most full-blown ftp programs do ... you'll need the rfc for the ftp protocol and all that and then its not too difficult ... i dont know if there is any windows source code available to show it but i'm sure there would be some unix stuff around that wouldn't be too different in the basics of sockets etc
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Ok, still problem though:
I am using a derived CAsyncSocket (CFtpSocket) for initial connection. (Tried this with both CSocket and CAsyncSocket)
When I call the Connect(host,port), it returns true, giving me the initial socket connection. However, at that point, shouldn't I get a welcome message? I have been comparing what my program gives to what CuteFTP gives, and it says:
STATUS:> Connect: Monday 17:10:21 05-07-2001
STATUS:> Connecting to ftp.angelfire.com
STATUS:> Connecting to ftp.angelfire.com (ip = 216.33.20.80)
STATUS:> Socket connected. Waiting for welcome message...
220 Hi! Welcome to Angelfire's NEW FTP.
But in my program I never get that welcome message. It just stops after the socket connects. I have the OnReceive() overwritten and it SHOULD call that when I get the welcome message right? Or am I missing something? OnReceive is never getting called in my program.
Adam
cabadam@houston.rr.com
|
|
|
|
|
ummm
that is the ftp server answering a log-on request from the client app
you have to establish the connection and send the required commands to get anything going that u can work with
as i said ... check out the rfc on the ftp protocol to get a command list
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
LOL OK.. Thats what I deserve for trying to think while tired. Turns out my socket was going out of scope and being destroyed... *face turns red*
OK-- now I got my welcome message and I have read the RFC on FTP protocol so I understand pretty much how FTP is supposed to work. Now I need to actually send commands.
Ok, lets say I have:
CString command = "USER someone";
What do I need to tack on to the end of command to correctly send it?
I know the RFC said to have a carriage return and line feed. Isn't that \r\n? I tried that and nothing happened after I sent it. Tried adding basically every combination ("\r", "\n", "\r\n", "\n\r", "")
Still nothing worked.
Also, to send it, I should just do this correct:
char* buf = command.GetBuffer(command.GetLength());
Send(buf, sizeof(buf));
Thanks!
Adam
cabadam@houston.rr.com
|
|
|
|
|
Where can I find the default Internet Explorer (On 95/95/NT/2000?)
And launch it on a given page (local, intra or internet string ? )
Thnx
Wimel
|
|
|
|
|
ShellExecute will open IE to a page you want if you just ask it to open the URL, assuming IE is the default browser.
Christian
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
i need someone who can help me to configure this whole thing to work properly. i downloaded and installed the directx 8 sdk and the crystal space engine. built the engine and now i dont know where to even begin. any help would be appreciated.
Tinnin4eva
|
|
|
|
|
When you say you don't know where to begin, what do you mean ? Have you used DX before ? Have you read the Crystal Space docs ? Joined the mailing list ? Played with the demonstration applications provided ?
I haven't used Crystal Space ( 3D is high on my gunner list, but below GDI+ as of a few days ago, so unlikey to happen soon ) but I'd suggest that while others here *might* know a bit about it, you're more likely to find meaningful help from the mailing list, which is full of people who are using it. I'm not suggesting it's wrong to ask here ( it isn't, at least not in my NSHO ), but just that your success rate could be higher if you also try the people who are all using it and discussing it's use.
Christian
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
Hi,
I have some questions of you,
What is Crystal Space ?
How can i download it ?
Thanks for reply ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi!
I've spent quite a lot of time trying to convert a regular DLL into an extension DLL. The
problem is that the memory managment seems to be broken. The compilation and linking is warning-free, but when I start to test the application, I get all sorts of memory-related errors. Which errors depends on which features I test during the debugging session.
Error examples:
HEAP: Free Heap block 347fd0 modified at 348040 after it was freed
Acess violation when trying to write to normal variables.
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)); fails.
What do you think, have I done something bad in the DLL, or perhaps do I have some problem
which wasn't discovered when using regular DLLs?
//Olof
|
|
|
|