|
Hi Experts,
I want to create instance of a inteface(IPropertyBag) ,defind in a abc.dll file.
And same name interface exist in ocidl.h file.How can i pass a correct GUID
so that i can access method defind in abc.dll.
i try like this
IPropertyBag* Properties;
hr=CoCreateInstance(__uuidof(PropertyBag),NULL,CLSCTX_INPROC_SERVER,
__uuidof(IPropertyBag),(void**) &Properties);
I also saw the CLSID with visual studio ole tool .Can i pass the the direct CLSID.
CoCreateInstance((uuid(47000673-7DB2-44C9-8AC1-65266117D280),NULL,CLSCTX_INPROC_SERVER,
__uuidof(IPropertyBag),(void**) &Properties);
But it dispaly syntext error.
error C2059: syntax error : ')'
error C2059: syntax error : 'bad suffix on number'
error C2059: syntax error : 'bad suffix on number'
error C2059: syntax error : 'bad suffix on number'
How can i make it correct.
Can i pass the Interface name abc(dll file) wrapper if yes how ?
|
|
|
|
|
The first problem here is the syntax issue with the CLSID you're passing to CoCreateinstance. the big number with the -'s in is not in a form that the C++ compiler can understand. MIDL which handles .idl files might be OK with this but in a .cpp file it's a no. You have to translate theses GUIDs (Globally Unique IDentifiers) to a struct with curly bracket syntax :-
{0x0000, 0x00, 0x00, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
//Microsoft's definition of a GUID is like this
<br />
typedef struct _GUID <br />
{<br />
DWORD Data1;<br />
WORD Data2;<br />
WORD Data3;<br />
BYTE Data4[8]; <br />
} GUID;<br />
There is a more fundamental problem here though. It appears you're trying to create an instance of IProperyBag?
If so, this is the root of your problem. You need to be creating an instance of something that implements IPropertyBag. It's like trying to create an instance of surfing, when what you need is an instance of a surfer. The surfer or in this case the thing that does IPropertyBag will have a Class ID (CLSID) and this is what needs to be in the call to CoCreateInstance. A CLSID is just a typedef of a GUID.
If this doesn't make sense or isn't clear (It's a while since I did much COM at this level) I recommend trying the experts in the COM forum who will undoubtedly be able to explain it better.
All the best.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi
I am trying to derive from CSplitterWnd but it is not listed in MFC base class list box. any help plz
|
|
|
|
|
|
TariqZ wrote: I am trying to derive from CSplitterWnd but it is not listed in MFC base class list box
You may have to actually type it in yourself
Something like this should work:
class AFX_EXT_CLASS CMySplitterWnd : public CSplitterWnd
{
DECLARE_DYNAMIC(CMySplitterWnd)
public:
CMySplitterWnd();
virtual ~CMySplitterWnd();
...
};
IMPLEMENT_DYNAMIC(CMySplitterWnd, CSplitterWnd)
CUluSplitterWnd::CMySplitterWnd() : CSplitterWnd()
{
...
}
CMySplitterWnd::~CMySplitterWnd()
{
...
}
...
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
How to send a mail from mfc program
|
|
|
|
|
You need to take a look at the interface called MAPI in the docs or if you don't like the look of that have a look for SMTP (Simple Mail Transfer Protocol). Depending on how much external stuff you want to rely on sending mail can be anything from a one line call to a 6 month project
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
|
Hi all:
I need to employ seekg() and streampos to extract a string containing a certain word from a text file.
I have written:
typedef vector<streampos> OccurrenceList; //OccurenceList is an array of vectors which hold all the "streampos" for a given word.
vector<streampos>::iterator it;
for (it = occurrences.begin(); it != occurrences.end(); it++) {
*it -= 35; //Set the negative offset.
fin.seekg(*it); //fin is the text file.
cout << fin.get(); //Get one character to verify that everything works before proceeding any further.
}
But what I got (111) is NOT what I expected.
Can any one help?
Thank you
|
|
|
|
|
Would I like to know why you are setting the negative offset
|
|
|
|
|
Hi:
The original value of streampos is the location of a word, which is alway in the middle of a sentence. I need to set the negative offset, so I can print out the sentence which contains the word I am given.
Thank you
|
|
|
|
|
Hi,
I guess you are trying to move back to 35 position from the word.
I suggest donot use such logic and a constant value how you get the value 35, won't it be 34 or 36.
Ok I think the resolution is ,when negate the streampos, take care the effective value is not less than 0
i.e *it = (*it - 35) < 0 ? 0 : *it - 35;
Then I think the "it" has the word position, hence "*it-=35" will change the correct position of word, use temporary variable
ie;
seekg((*it - 35) < 0 ? 0 : *it - 35);
|
|
|
|
|
What is the sort order used by _findfirst / _findnext when finding files in a directory? MSDN says _findfirst finds the FIRST INSTANCE of a file matching the given mask, but doesn't define FIRST INSTANCE. If this is an attribute on the directory, is there any way to change it before traversing the directory for files? I need to process each file the directory in FIFO order.
Thanks.
|
|
|
|
|
FIFO order relative to what?
From the docs: "The order in which this function returns the file names is dependent on the file
system type. With NTFS and CDFS file systems, the names are returned in alphabetical order. With
FAT file systems, the names are returned in the order the files were written to the disk, which
may or may not be in alphabetical order."
If you want them sorted you'll need to do that yourself.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
my program minimizes to the system tray i need to know how to make the message that shows when you put the mouse over the icon update or is it even possible?
|
|
|
|
|
Do you mean the tooltip?
If so, use Shell_NotifyIcon(NIM_MODIFY, ...) with the NOTIFYICONDATA struct szTip member (or
maybe szInfoTitle if you're using balloons) set to the new text you want.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
I have PretranslateMessage() that checks for WM_KEYDOWN message to capture keystrokes.
Then I do my processing from the code it gives me..
int key = (151 + HIWORD (pMsg->lParam) & 0x00ff);
All works great, but I want to be able to test it to see if it's a repeat key before processing.
That is, if the key is held down, I don't want the repeats to get through.
How can I extract lparam bits into a var to see if the message is a repeat key?
I beleive 0-15 in lparam tell repeat status.
Sorry, I get kinda stumped when I get into working with data on bit and byte level.
Thanks...
|
|
|
|
|
Something like this...
WORD wRepeatCount = (WORD)(lParam & 0x0000FFFF);
bool fPreviousKeyStateDown;
if (lParam & 0x40000000)
fPreviousKeyStateDown = true;
else
fPreviousKeyStateDown = false;
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark.. your the man.
|
|
|
|
|
Great, but how can I get the extended key info (i.e., ALT or CTRL keys) ?
Thanks in advance.
Mizan
|
|
|
|
|
sure hope there is a simple answer to this question, but for the life of me I can’t find one.
I’ve written a process that collects data from various Internet sites, re-organizes it, and then creates a new series of web pages. I want to share these pages with a user’s group that I am a member of. The problem is how to automatically upload the files to a Windows based Web Server.
I need to do this with Visual Studio 6.0 (not .net) talking to straight ASP (again, not .net).
I can’t use FTP because I am behind a firewall!
I have written a form that has a browse button that talks to an ASP uploader process on the server, and that works great. The problem is that you have to browse to each and every page every time you want to upload something. Browsers will not allow you to default the file path and submit the form “on-load”. If they did that someone could create a link that as soon as the page was loaded to your PC, it would automatically upload “CreditCardNumbers.txt” or any file they wanted to their server.
This process has to run in the background on its own. It has to monitor a directory, and when it sees a file in that directory, upload it to the web server. No human intervension.
So, here are the two questions:
1. Does anyone know how to emulate the “multipart/form-data” stream that is created by the browse button on a form upload process?
2. Is there another way to upload files without using FTP.
PS: This is my first post here, and it is always fair to give something if you want to receive something! If anyone would like information about how to write the SPIDER that will be the front end that feeds files to this uploader, just make a reply to this post and let me know how to go about exchanging private messages.
|
|
|
|
|
BitWare wrote: If anyone would like information about how to write the SPIDER that will be the front end that feeds files to this uploader, just make a reply to this post and let me know how to go about exchanging private messages.
So why not just write an article?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
See how simple that was. I will work on the article and post it in a few days.
It will be a simple console AP that will go to yahoo finance once every minute to get the latest quote for microsoft and also the latest option prices for microsoft. I will document how I got the pages and give teh source on how I scanned the pages to retrieve the information.
Sorry for being very new here, but where do I get details on how to upload the ZIP file of the source code and documentation?
|
|
|
|
|
BitWare wrote: Sorry for being very new here, but where do I get details on how to upload the ZIP file of the source code and documentation?
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|