|
Rajdeep.NET wrote: ...I have to get the path of the executable, but I cant code this in C++.
Why not? Don't you have access to argv ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
If you read through the messages in this thread you'll get an idea of his level of knowledge...
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hi, I have a problem running this code, it doesn't do what it's supposed to do. Can anybody give me a hand? thanks
int main(){
char answer='S';
while (answer=='S'){
printf("another?: ");
scanf("%c",&answer);
}
return 0;
}
|
|
|
|
|
Denis J. González wrote: it doesn't do what it's supposed to do
That depends on what you're trying to do.
And you haven't mentioned what the problem is.
All I can say now is that you might need an fflush(stdin) after the scanf
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
That did it! great! thanks!
what does fflush(stdin) do?
|
|
|
|
|
It clears the standard input buffer, in this case the keyboard buffer.
When you key in a character and press enter, the keyboard buffer will contain the keyed in character and the carriage return (enter key). Only the keyed in character is taken into the buffer (answer). So now the carriage return has to be cleared, otherwise the next scanf will automatically take that.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
When I attempted to import 'MS-WORD' and 'MS-EXCEL' as MFC type lib, an object file link error occurred.
What should I do if I want to use 'MS-WORD' and 'MS-EXCEL' together?
thank you ...
|
|
|
|
|
Hows about you give some more detail about those errors....
Personally, I use #import[^] to make external COM libraries available in my code. Works very well.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I guess WORD and EXCEL will have different namespaces which should help you resolve the issue.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
some namespaces tips?
#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" no_namespace
#import "C:\\Program Files\\Microsoft Office\\Office11\\MSPPT.OLB" no_namespace
Following is error message:
error C2367: 'IFilter' : redefinition; different uuid specifiers
..
..
..
modified on Tuesday, June 16, 2009 1:24 PM
|
|
|
|
|
Do not use no_namespace .
I really don't know the exact namespace given to excel and powerpoint.
But assuming it is excel and ppt, you now access the IFilter or any other interface for that matter as excel::IFilter and ppt::IFilter .
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I'm pretty new to VC++ and need to write a fairly simple barcode application that reads and writes data to a file. The file is then uploaded using activesync for processing. Can anyone point me in the right direction in terms of dialog based / window based and file input / output?
thanks.
|
|
|
|
|
Hey
Well, if you need to use forms I would suggest for you to use C# instead.
If there are things I have to do in C++ than you can always create a DLL with exports or COM DLL... depends on your requirements.
Anyway, if you want to create forms in C++ I would suggest using MFC (just follow the wizard in visual studio). Explaining exactly what is going on over there is a bit big for a that forum, but there are plenty of articles out there. Besides, I always believe that some trial and error is a good experience with new environments.
about reading and writing a file, you have several options:
- If you're using MFC, the easiest thing is to use MFC's CFILE class (I hardly use MFC so I can't really tell you much about that class, but I am sure it is easy to use this class).
- Another option is to use CATLFile, which is a class that literally wraps WIN32's read/write functions.
- You can use win32's read/write functions:
CreateFile()
ReadFile()
WriteFile()
you can see their signatures in MSDN (F1). There are some options for these functions and MSDN explain what each option means, if it gets a bit complicated, just ask...
- If you want a portable code (that will compile on windows and unix as well) you can use plain good old C functions: fopen() fread() fwrite().
|
|
|
|
|
Hi everybody
Can anyone please explain what is the difference between OLE and a COM?
I know that COM derives from OLE, but what OLE component lacks that doesn't make it a COM component?
In other words, I know what COM is, and I created several COM servers in C++, but I don't quite understand what is OLE...
Thanks A LOT in advance!
|
|
|
|
|
Green Fuze wrote: COM derives from OLE
Other way round. COM describes the concepts of interfaces, reference counting and a central registry. OLE uses those concepts to do the whole object linking and embedding thing.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Oh...! So now I know how to fit in that Corba thingy!
So OLE components are COM components that are being embedded into applications (for instance, for IE it is ActiveX) ???
|
|
|
|
|
Green Fuze wrote: So OLE components are COM components that are being embedded into applications
That was the original meaning of OLE. The 'real' definition of OLE (I suppose) is that it's a defined set of COM interfaces that you can implement or consume to interact with other OLE objects. For example, if your application implements IOleClientSite (among others), you can host OLE objects.
Green Fuze wrote: for instance, for IE it is ActiveX
Not quite - ActiveX was Microsoft's 'rebranding' of 'OLE custom controls'.
ActiveX got reused as a general adjective for technologies that used COM under the hood - ActiveX Data Objects (ADO), for example.
Green Fuze wrote: So now I know how to fit in that Corba thingy
Corba's another similar but different thing again It's probably most similar to COM, but it has a wider scope.
The Wikipedia pages on ActiveX, COM, OLE and Corba are probably worth reading.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks!
I think I get it better now!
I'll also check Wikipedia.
Thanks again!
|
|
|
|
|
I created 2 edit boxes using CreateWindow..
In callback function, how can i know which edit box gets/loses focus/caret when clicking in one of the boxes?
Somehow, GetFocus() returns screen handle instead of edit box.
public delegate IntPtr WndProcCallback(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public IntPtr WndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
{
switch (uMsg)
{
case WM_SETFOCUS:
//??? who gets focus
break;
case WM_KILLFOCUS:
///??? who loses focus
break;
default:
return CallWindowProc(lpWndProc, hWnd, uMsg, wParam, lParam);
}
return IntPtr.Zero;
}
|
|
|
|
|
Look at the[^] documentation[^] - it's the window that gets the WM_SETFOCUS/WM_KILLFOCUS message that gets/loses focus respectively.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi gentlemen,
is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl.
I've tried:
hDesktopWindow = GetDesktopWindow();
HDC hdc = GetDC(hDesktopWindow)
or
HDC hdc = GetDC(NULL)
and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows.
I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows.
or
HDC hdc = GetDC(GetDesktopWindow())
int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap)
iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE
Any idea?
Thanks.
|
|
|
|
|
daavena wrote: HDC hdc = GetDC(GetDesktopWindow())
Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead.
This will simply capture the existing screen on all monitors.
If you want to get the desktop wallpaper you should use
SystemParametersInfo(SPI_GETDESKWALLPAPER, ...
Look at the documentation of SystemParametersInfo Function[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
thanks for your reply,
Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead
but as you said this capture whole screen with all windows - I do not need this.
What I need is screen backgroud without any windows. Because I need copy a part of screen backgroud to my window.
I know SystemParametersInfo function. It gives me the name of wallpaper only.
|
|
|
|
|
In a multi-doc. app. with the view based on CScollView which is used to display images, I'd like to display a dialog window with some histogram graphics in it. The problem is the OnPaint function for the dialog needs a few of the document's variables to draw the image's histogram. Making the variables pulic doesn't help because the compiler says they're non-static. And I can't seem to get the GetDocument() function to work in the dialog class like it does for the View class. Is there a way to do this with GetDocument() or do I have to derive the dialog class to the View some how, or a ChildView? Any help would be appreciated.
|
|
|
|
|
Pass references or pointers to the variables into the dialog, either through a constructor or through accessors.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|