|
Most COM functions are __stdcall. You will probably create some confusion if using __cdecl. Also note that you will only be able to connect to C/C++ clients using __cdecl, which somewhat defies the purpose of COM. I suggest you only use __cdecl if you need variable parameters, and really can't think of a way around this.
/moliate
|
|
|
|
|
This is off of the topic from the original question, but it may shed some light on why particular conventions were chosen.
The key to all COM object interfaces is that they all have to use __stdcall. That is how it becomes safe to call objects that some complete stranger wrote with this model. Everyone uses the same calling convention.
The reason why this convention was chosen over _cdecl, is that the variable length parameter lists make this format unsafe if an interface function call needs to be marshalled to another machine, the proxy code would not know how many parameters and what types they are to marshal.
|
|
|
|
|
If I create an MDI application visual C++, how can I create an openGL child window for the application?
|
|
|
|
|
Check the opengl section. There are many examples.
http://www.codeproject.com/opengl/
|
|
|
|
|
Hi,
I manage to insert one ActiveX in my word doc, using:
COleVariant vClassType = "GrAxProof.GDIGraphics";
Word::InlineShapePtr pShp = m_pWord->GetSelection()->InlineShapes->AddOLEObject(vClassType);
Now the problem, comes when I save the Word file, and I load it again, then a metafile is shown but when I press double click, it appears this message:
The server application, source file, or item cannot be found, Make sure the application is properly installed, and that it has not beed deleted, moved, or renamed.
What should I do to avoid this ?, Thanks, Bye !
Braulio
|
|
|
|
|
is it possible to create a listctrl in report view, with several columns. Where some of these columns are comboboxes?
|
|
|
|
|
There are examples of how you can manipulate the listview controls while in report view here at CP.
I don't think any of the examples use comboboxes, but there is statusbars, edit boxes...etc...I imagine the edit fields are implemented with a floating CEdit control.
You could do something similar with a combobox control i'm sure.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Of cource it is possible to create a listctrl in report view but about comboboxes it is better to check ListCtrl part in CP maybe there is something there.
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi All,
I have a parent window that contains an OLE object. I want the OLE object to draw on its parent's DC (for animation). This isn't too much of a problem, as I can get the parent CWnd and associated DC.
The problem is however - I have pre-written code to do the drawing that expects to start drawing at 0,0. This means the graphic is always at the top left of my parent window. What I want to do is shift the graphic to the right and down so it's above the object.
I *think* what I want to do is shift the whole parent DC to the right and down, but I'm not sure how to go about this.
Any help greatly appreciated.
Paul.
|
|
|
|
|
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cdc.3a3a.setviewportorg.asp">CDC::SetViewportOrg</a> is what you need, I guess.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
Thanks for your post.
I currently have the following code:
CRect recOLEObject; //Set using GetWindowRect when I activate
//the OLE object temporarily
CRect recApp; //Set using GetWindowRect
CPoint ptDCShift;
ptDCShift.x = recOLEObject.left - recApp.left;
ptDCShift.y = recOLEObject.top - recApp.top;
pDC->SetViewportOrg(ptDCShift);
The wierd thing is, as I start and stop the animation the amount of shift changes (never being in the right place, I should point out), and 'steps' down the screen.
Paul.
|
|
|
|
|
Sounds like you need to reset the viewport to what it was originally after you're done.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Now look at the code Mike Dunn (or anyone):
void CWallpaperDlg::OnButton1()
{
CoInitialize(NULL);
HRESULT hr;
IActiveDesktop *pActiveDesktop;
//Create an instance of the Active Desktop
hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**)&pActiveDesktop);
if(SUCCEEDED(hr))
{
hr = pActiveDesktop->SetWallpaper((LPCWSTR)"C:\\Mina dokument\\Mina bilder\\eros15.gif", 0);
if(hr != S_OK)
AfxMessageBox("Fail?");
}
else
{
AfxMessageBox("dgfd");
}
// Call the Release method
pActiveDesktop->Release();
CoUninitialize();
}
Well, as you see I check if the code is NOT S_OK but the dialog will never show up.
but how to get it Unicode? I've tried type cast it with many Unicode types but is always says "cannot conver from ... to ..."
------------------------------------
<b><I><B>Rickard Andersson</I></B></b>, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Your attempt to get a LPCWSTR by forced casting is wrong. Instead, use wide char literals like this:
hr = pActiveDesktop->SetWallpaper(L"C:\\Mina dokument\\Mina bilder\\eros15.gif", 0); Note the L prefixing the string.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
With your help and with some small "brainstorming" I'd get it to work!
I had to call ApplyChanges(...) after call of SetWallpaper to see the wallpaper.
Thank you!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Hi,
Where shall we declare an array to be assigned in a function of a class and accessed in a function of other class?
|
|
|
|
|
1. make a member variable in one of the classes.
2. when you call the function in the other class, pass it a pointer to the instance of the first class as an argument.
eg:
class bob
{
public:
int nAge;
}
class fred
{
public:
void LaughAtBobsAge(bob* bobclass);
}
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hi,
Can someone tell me the Registry entry that can tell me who is the current user for Win95-XP
Thanks
San
|
|
|
|
|
You can get user name from environment variable USERNAME. Use GetEnvironmentVariable function.
|
|
|
|
|
This is for Win98
Key :- HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control
String :- Current User
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Same format for Win95 OSR2.
Anyway, why not rely on good ol' <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_9jj9.asp">GetUserName</a> instead of look into the registry?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Anyway, why not rely on good ol' GetUserName instead of look into the registry?
Dunno! Sanskypotov wanted to know where it's stored in the registry. Maybe he wants to try changing it and seeing if it will have any effects on some SAMBA share on his network
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
I have a VC++ editor and i want to track the changes in the editor.Means i first load the entire content of the editor in an array .After i executed a function at that time i can change the editor .How i can make an array that reflects the mirror copy of the changes in the editor.
CStringArray strText; contains the original array
then i called the function
after that i can change the content of the above mentioned editor .
my requirment is how i can tap the changes in the editor to my array strText.I need to copy all changes in the editor to the original array
Please help
|
|
|
|
|
If you used std::vector or std::list instead of CStringArray, you would probably find an algorithm provided by the standard library that does this for you, or it would be easy to write one, which would go through line by line, and make a new vector of just the lines that had been changed.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Hi !
I managed to insert several ActiveX controls in Ms Word, using:
[ccode]
Selection.InlineShapes.AddOLEObject
[/ccode]
Now I want to load the document in my app and iterate through all that ActiveX controls in order to set some properties, how can I do that ?
( I have tried with GetSelection adn GetInlineShape, but without success... ).
Thanks, in advance, Bye !
Braulio
|
|
|
|