|
CString str = "192.168.1.155";<br />
BSTR host = str.AllocSysString();<br />
long port = 3246;<br />
m_dvt.Connect(&host,&port);
First, you are going a really long way just to create a BSTR , you can save yourself one allocation:
CComBSTR bstrHost( "192.168.1.155" );<br />
long port = 3246;<br />
m_dvt.Connect(&bstrHost,&port);
Second, what error is being returned? It looks like you are calling the method correctly, was the object created correctly?
Third, when you have to pass pointers to a COM method, it is often because you are going to get something back from the method via those pointers. COM rules state that if you pass a BSTR pointer, you own whatever BSTR comes back via that pointer, and you transfer ownership of the BSTR you sent, if any. CComBSTR will automatically deallocate the BSTR (either the one it created, or the one you get back) when its destructor fires.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I receive two errors,
1."Run-time error'9': Subscript out of range" from activeX control itself.
2."Application-defined or object-defined error" thrown by the application.
|
|
|
|
|
I came to know the problem is within the activeX control itself. I download the latest control and its working fine without errors.
Thank you James.
|
|
|
|
|
Hi,
I'm trying to code a program to verify the digital signature of several exe, dll,... files. The problem is that I don't have the certificate nor signature that is applied to those files, and neither I know if I need them . I've been looking to microsoft msdn CryptoAPI, but I could not get nothing clear out of the examples.
I suppose that I need to:
- extract somehow the signature or certificate from the loaded (BYTE*) file
- obtain a key form that certificate
- generate a hash value with CryptCreateHash and maybe later call CryptHashData?
- and finally call CryptVerifySignature praying for succes...
Any clues or full sources are welcome. I'm quite lost now .
Thanks in advance.
|
|
|
|
|
I'm trying to allow URL's to be dragged out of my app and into a browser. The relevant bit of code looks like this:
<br />
static COleDataSource gOleDataSource ;<br />
<br />
void CUrlDragDropTestDlg::OnLButtonDown(UINT nFlags, CPoint point) <br />
{<br />
HGLOBAL hGlobal = ::GlobalAlloc( GMEM_MOVEABLE , 4096+1 ) ;<br />
LPSTR pUrl = (LPSTR)::GlobalLock( hGlobal ) ;<br />
strcpy( pUrl , "http://www.test.com" ) ;<br />
::GlobalUnlock( hGlobal ) ;<br />
gOleDataSource.CacheGlobalData( RegisterClipboardFormat(CFSTR_SHELLURL) , hGlobal ) ;<br />
DROPEFFECT dropEffect = gOleDataSource.DoDragDrop( DROPEFFECT_LINK|DROPEFFECT_SCROLL ) ;<br />
<br />
CDialog::OnLButtonDown(nFlags, point);<br />
}<br />
This works fine for IE but not Mozilla/Firefox. Looking at what clipboard formats these apps use when dragging URL's *out* of them, the only one that seems to make sense is "UniformResourceLocator" i.e. the same one I'm using above. Dragging stuff *into* my app works fine, checking for this format.
However, when I try to drag my URL into Microsoft's IDataObject Viewer tool, it doesn't want to accept it so I'm guessing that I'm missing something. Anyone know what?
BTW, Opera doesn't seem to allow URL's to dragged at all Anyone know why they decided to do that?!
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
My guess is that Mozilla/FireFox does not accept the CFSTR_SHELLURL format as a target. You could try using the CFSTR_INETURL format as well. See if you can drag a link from IE to Moz/FF. If you can, see what other CF formats it exposes in the D&D object.
Do not forget that you should also make available other formats, like CF_TEXT /CF_UNICODE , so that you can interoperate easily with other applications.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote:
My guess is that Mozilla/FireFox does not accept the CFSTR_SHELLURL format as a target.
This is really weird. You'd think Firefox would accept what it's putting out These are the clipboard formats that each browser puts out when dragging a link:
Dragging a link from IE (into my app):
UntrustedDragDrop
FileGroupDescriptor
FileGroupDescriptorW
FileContents
UniformResourceLocator
Dragging a link from Firefox (into my app):
13
FileGroupDescriptor
FileContents
UniformResourceLocator
13
13
text/_moz_htmlcontext
text/_moz_htmlinfo
text/html
HTML Format
13
1
where 13=CF_UNICODETEXT and 1=CF_TEXT.
text/_moz_htmlcontext is the HTML page, text/_moz_htmlinfo some binary data.
I then tried dragging links into IDataObject Viewer:
Dragging a link from IE into IDataObjectViewer:
- not allowed
Dragging a link from IE into IDataObjectViewer:
Unknown Clipformat
FileGroupDescriptor
FileContents
UniformResourceLocator
Unknown Clipformat
Unknown Clipformat
text/_moz_htmlcontext
text/_moz_htmlinfo
text/html
HTML Format
Unknown Clipformat
CF_TEXT
Dragging a link between the two browsers:
Dragging a link from Firefox into IE: OK
Dragging a link from IE into Firefox: not allowed
I've also tried including various combinations of different clipboard formats.
James R. Twine wrote:
You could try using the CFSTR_INETURL format as well.
I can't seem to find a definition for this constant. The only references I found on the net defined it as "UniformResourceLocator" i.e. the same as CFSTR_SHELLURL
BTW, I got a lot of the way to where I am now by reading your hyperlink article. Thanks for that!
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Well, I believe in the "when in Rome..." concept when dealing with cross-platform development. In Windows, a URL link, when dragged-and-dropped, has the format of CFSTR_SHELLURL , so that is what you use. When you wanna play in our sandbox, you follow our rules!
As such, I would be of the opinion that those issues are (serious) bugs in those apps.
If dragging from Firefox into IE actually WORKS correctly, you can figure out which format IE is accepting, and expose it yourself. I have to have enough faith in other developers that Firefox allows you do drag a link from one instance of itself to another, so there is at least one format it accepts...!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I'm baffled at the results I got since I, too, generally trust programmers to get basic things like this right (and yes, Firefox allows drags to another instance of itself). The only format the two browsers seem to share is UniformResourceLocator but it doesn't seem to be working.
This is the point at which I give up, I think. Annoying, since I use Firefox most of the time. Sigh...
Thanks for your help.
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Are you sure you are exposing that format correctly? Also, it might look for another format as a "signature" that it is something it wants to accept.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote:
Are you sure you are exposing that format correctly?
What do you mean by "correctly"? The fact that the URL I am exposing is not being accepted by IDataObject Viewer makes me suspicious that I'm doing something wrong but having said that, it doesn't want to take URL's dragged from IE either
The code I'm using was included in my original post.
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I think I see the problem. Change DROPEFFECT_LINK to DROPEFFECT_COPY .
The DROPEFFECT_LINK style has nothing to do with hyperlinks, it has to do with COM/OLE Linking. Also, remove the DROPEFFECT_SCROLL style, I believe that it is not supposed to be specified directly by the drag-source, just received by the drag-target.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Ah. I had been playing around with those switches to see what they did Just specifying DROPEFFECT_COPY caused Firefox to *accept* the dragged URL but not actually open the URL However, it appears to be looking for a CF_TEXT/UNICODETEXT format instead.
So for the record, drag out CFSTR_SHELLURL and one of CF_TEXT or CF_UNICODETEXT and it seems to work with both IE and Firefox. Opera appears to be a lost cause
Thanks so much for your help
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Does anyone know of a good reference for this task?
I'm finally able to pull my development head out of the sand and look at the VS 2005 (beta 2), and I was blown away by the added complexity of doing something as simple as putting a few fields on a form (what ever happened to dialogs???) and then display a message. (AfxMessageBox? What's that??????)
|
|
|
|
|
Brad Bruce wrote:
AfxMessageBox? What's that??????
System::MessageBox::Show()
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Yeah, it took 10 minutes to find that one.
I'm leading a team of developers and hope to find a concise set of migration notes. (What's been replaced with what, new though processes etc.)
From what I've seen, the migration won't be easy. If VC++ is so different between version, no wonder C# is getting so much attention....
|
|
|
|
|
I am no expert so I may be talking out of turn but AfxMessageBox is a MFC function while anything with System::... is a .NET managed extension. Maybe if you turned off managed extensions (/clr if I am correct) things will work better for you.
If VC2005 does not include support for MFC I will definitely not be upgrading from VC6.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
The express edition does NOT come with MFC.
I'm waiting for the download to finish for the regular version of VS 2005 (b2) to download.
|
|
|
|
|
upgrade to standard version or team system.
http://blog.joycode.com/jiangsheng
http://blog.csdn.net/jiangsheng
Command what is yours
Conquer what is not
---Kane
|
|
|
|
|
We work previously with Visual C++ 6.0 and the dialog box wizard to create basic control works fine. We bought Visual C++ .net Standard and now the dialog box wizard does not work.
Is it the limitation between the standard and the professional version or is there an update to fix that?
Thanks a lot
Benoit
|
|
|
|
|
There is no class wizard in the .net series of visual studio, all is done in the property window (AFAIK )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
When I right click on a dialog ressource (edit control for example) I have a menu to "add a variable". This menu opens a wizard to generate codes for this control ("Welcome to the Add Member Variable Wizard ").
Benoit
|
|
|
|
|
I have downloaded and used:-
<big>simples.c - Simple TCP/UDP server using Winsock 1.1</big> Now I have built and run a Client and Server Win32 Console application using this sample using my data structure. But problem with using the same code in a worker thread of a MFC application.
The following line causes problems:-
char *interface= NULL;
It generates the following errors:-
c:\ExampleDlg.cpp(214): error C2332: 'struct' : missing tag name
c:\ExampleDlg.cpp(214): error C2011: '__unnamed' : 'enum' type redefinition
c:\ExampleDlg.cpp(214): warning C4518: '__unnamed ' : storage-class or type specifier(s) unexpected here; ignored
c:\ExampleDlg.cpp(214): error C2059: syntax error : '='
Whats the solution to this problem please anyone?
|
|
|
|
|
May be the download stuff itself got some bugs in !!!
May I know what you trying to do?
|
|
|
|
|
Just want to receive a packet of data from another application on another PC. So I will be the Server.
The Microsoft sample works fine (as a console application), but its when you try and use the code in an MFC application get these errors.
|
|
|
|