|
How to change the background image of the desktop window? Or is there an article I can read about it? Thanks!
|
|
|
|
|
Search MSDN for IActiveDesktop interface, it has got methods which help you change the background of Desktop.
<edit> I was assuming you where asking about changing desktop background image, if you want to paint your apps window with images, then you
can override OnDraw if its a CView based app. to start with </edit>
Cheers,
Kannan
|
|
|
|
|
Have a look at SystemParametersInfo and the SPI_SETDESKWALLPAPER parameter.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
How to open HTML Help file from my MFC application at a specified location - let's say not at the beginning but at 'contacts & credits'(the last) page?
|
|
|
|
|
i have created test_build.dll, xxx.h, xxx.def.
next i created testexe to try calling functions inside that dll.
but this testexe does not compile - error msg about
unresolved external symbol...
indicating it could not 'see' those functions inside the dll.
question - what settings on this testexe project i need to set/un_set for it to work?
|
|
|
|
|
There are two ways to do it:
-link your testexe with a .lib file created when you compile the dll
-use LoadLibrary and GetProcAddress to load the dll during execution of the test executable
|
|
|
|
|
i am a total amateur with vc++ so pls bear with me...
>-link your testexe with a .lib file created when you compile the dll
this would mean i am hard-wiring my .lib to the testexe build?
>-use LoadLibrary and GetProcAddress to load the dll during execution of >the test executable
with the following code("square" is on of the functions inside test_build.dll)
FARPROC * lpfProcFn;
HINSTANCE hLib;
hLib = LoadLibrary("test_build.dll");
*lpfProcFn = GetProcAddress(&hLib, "square");
?? how do i now call that "square" fn ??
abc = square(45); <-- compiler will complain unresolved fn...
thanks.
|
|
|
|
|
If your square function has for example the following definition:
<br />
int square(int a,int b);<br />
you could do it this way:
<br />
typedef int (*proc)(int a,int b);<br />
<br />
HINSTANCE hLib;<br />
hLib = LoadLibrary("test_build.dll");<br />
proc fptr=(proc)GetProcAddress(hLib,"square");<br />
<br />
abc=fptr(1,2);<br />
|
|
|
|
|
I have a DLL written in Microsoft C 6.0 to be called by VB 6.0 main program. The VB 6.0 main program is compiled into an exe and copied to the DEBUG folder containing the DLL. When VC debug mode is started, a popup with exe not found is displayed even the VB exe exists in the folder.
Previously the VC Debug does function properly but all in a sudden the debug does not work. Please advise.
wavewave
|
|
|
|
|
Is the path to the exe correct under Project->Settings->Debug? Does it contain spaces, and if so, is it surrounded by double quotes?
Dave
|
|
|
|
|
The debug option is disabled and now revert to normal. Many thanks for hints.
|
|
|
|
|
The debug option was inadvertently disabled. Many thanks for helpful hints.
|
|
|
|
|
Long time listener, first time caller.
I'm breaking up a large application into some DLLs, and I'm having trouble with some dialogs. The DLLs are linked to the app implicitly, and use MFC in a shared DLL (in debug).
The problem is that dialogs internal to the DLL don't appear when I call DoModal(). By tracing the code, I've found that it can't load the dialog template, so the dialog fails to load. I've searched MSDN, but I haven't found anything that deals with dialog resources in an implicitly linked DLL.
What am I doing wrong? Do I have to do something to export the dialog template (and any other resources) when I compile, or do I need to do something in the linking application?
Thanks in advance!
-Aaron
|
|
|
|
|
The Dll try to load dialog template from your source module (in other hand, your EXE), because of this, it failed to load.
For solving this problem, I always export a function from dll.
e.g.:
extern "C"
__declspec(dllexport) int ShowSomeDialog()
{
CMyDllDialog dlg;
return (dlg.DoModal());
}
As you see, in the body of function, I call dialog. The dialog will appear with no problem.
You must call this function, in your main program. The definition of it looks like this:
__declspec(dllimport) int ShowSomeDialog();
Remember that to add Dll library to your project.
It's also possible to call this function explicity!
A. Riazi
|
|
|
|
|
I am basically doing what you've suggested, with two important differences that I can see:
1) The function headers are not 'extern "C"' I just use the regular C++ definitions. I don't think that affects my project, since everything uses C++.
2) The function headers used by the app are not declared __declspec(dllimport). Would this prevent the dialog resources from showing? I doubt it, since the functions I call work just fine.
I can call all the functions I export no problem, without 'extern "C"' or __declspec(dllimport). Yes, the lib is imported into my project (so the dll is loaded implicitly). Basically, my code looks very similar to yours:
In the app:
OnSomeCommand()
{
CallSomeDllFunc();
}
in the dll:
void __declspec(dllexport) CallSomeDllFunc()
{
CMyDlg myDlg(AfxGetMainWnd());
myDlg.DoModal();
}
Any ideas? Thanks again.
-Aaron
|
|
|
|
|
It's important that when implement a function (body of function), you use extern "C".
When you want using your function (inside dll) in your app, you must use __declspec(dllimport) !
In addition, I use this technique for regular dll.
Also, it's better to define your dialog function as below:
__declspec(dllexport) int CallSomeDllFunc()
{
CMyDlg myDlg();
return (myDlg.DoModal());
}
in this method, you can understand that which button was pressed by user.
A. Riazi
|
|
|
|
|
|
I trying to load an Icon from a file. ie c:\icon.ico. Which api function to use?
Thanks
|
|
|
|
|
LoadImage( NULL, _T("c:\\icon.ico"), IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
Dave
|
|
|
|
|
This is not a question or cry for help.
Rather, I wondered if anyone would be interested in some code that performs adaptive histogram equalization (AHE in imaging circles). If I see enough demand for it, I'll dust off some old code, wrap it up into a nice demo app and submit it as an article.
For those not familiar with the imaging field:
AHE is an algorithm to enhance the contrast of an image.
|
|
|
|
|
Here is some background info:
I code C++ for unix at my job. I have my directory shared via samba to my windows desktop. I have VS setup to use as my IDE.
Here is one question:
We save our files as *.cc instead of *.cpp and VS doesn't recognize this as a C++ file therefor I get no syntax highlighting and all that other cool stuff. Is there a way to add an extension (*.cc) to the list of C++ files?
Here is another question:
I added another folder to my project called libs where I put all of our classes. We have a class called Cstring and if I type Cstring:: it will pop up the box with all of member functions associated with that class. But if I do something like Cstring str; then type str. it does not pop up that nifty little box. Anyone know how to fix this? (Note: I am not actually compiling the files on my windows machine. Just saving them and then compiling on my unix term.)
Thanks in advance,
Jack
There are 10 types of people in this world, those that understand binary and those who don't.
|
|
|
|
|
I have encountered your
Cstring::/ Cstring str / str. problem with the autocomplete
as well. Sometimes I find it works for non-C++ native classes and sometimes it doesn't. I suspect that it is a bit flakey.
Unfortunately I cannot help you, but would appreciate anyone else's input who can shed some light on this...
|
|
|
|
|
An option to try is add the header file directly to the project. Don't count on the #include to parse the file for IntelliSense.
Phil Boyd
MCP
CPT, AR
You may be gone, but we will never forget your sacrifice.
"Proud to be an American..." Lee Greenwood
|
|
|
|
|
To force a file to be recognised as C++, use the /Tp option in your settings. Of course, you'll need to create a dummy project to have settings - put all your .cc files into it, and VC should be happy (it may even provide intellisense for you)
|
|
|
|
|
I have this in a static lib:
<br />
#ifdef _UNICODE<br />
typedef std::wstring _astr;<br />
#else<br />
typedef std::string _astr;<br />
#endif<br />
<br />
namespace SalieriFoundation<br />
{<br />
namespace Globals<br />
{<br />
void Func(const _astr &message)<br />
{<br />
...<br />
}<br />
}<br />
}<br />
Then I use it in a exe:
<br />
using namespace SalieriFoundation::Globals;<br />
<br />
Func(_T("the message"));<br />
So. I build ansi - fine. I build UNICODE and I get this:
<br />
<br />
Main.obj : error LNK2019: unresolved external symbol "void __cdecl SalieriFoundation::Globals::Func(class std::basic_string < unsigned short,struct std::char_traits < unsigned short > ,class std::allocator < unsigned short > > const &)" (?Func@Globals@SalieriFoundation@@YAXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z) referenced in function _main<br />
Edit: as asked by first reply changed the linker error message - added some spaces to avoid HTML-like text. Also I actualy have namespaces that you can see in the error message so I added in the above sample code - but I don't think it makes any diff.
What's wrong?
_UNICODE is defined in both projects.
I'm tying to find it for like 6 hours. Please help.
|
|
|
|