|
1) How do you set the icon of a dialog made in the resource editor?
2) Does anyone know of any other examples like this http://www.codeproject.com/samples/fortune.asp (with source) that dont use mfc?
|
|
|
|
|
»Archer282« wrote:
How do you set the icon of a dialog made in the resource editor?
Send the dialog a WM_SETICON message.
"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!
|
|
|
|
|
I have written a dialog based program using visual c++ and am now trying to deploy the project. The project deploys fine on all Windows systems with the .Net structure built into it. Any system that does not have the .Net structure built into it will cause the Setup.msi to say "Must install .NET blah blah blah first" and then it will close my installation package.
When I build the installation package within VC++, it says
"WARNING: This setup does not contain the .NET Framework which must be installed on the target machine by running dotnetfx.exe before this setup will install. You can find dotnetfx.exe on the Visual Studio .NET 'Windows Components Update' media. Dotnetfx.exe can be redistributed with your setup."
What, when, and where do I need to run that dotnetfx.exe? Do I include it with my installer? How do I do that?
Thank you,
Red Sunday
-----------------
http://www.zachcalvert.com
|
|
|
|
|
|
I dont see anything in the docs (looked at cfile). I need to concatenate two text files. After that I want to get rid of everything but the concatenated file. If mfc cant do it, is the best way to do it with
system(copy test1.doc+test2.doc b:test3) ?
I know about unlink()to delete. I was wondering if MFC can do it ....
Thanks,
sb
|
|
|
|
|
Any API capable of read/write operations can do that including Cfile.
Open file A for read
Open file C for write
Read all data from A and write to C
Close file A
Open file B
Read all data from B and write to C
Close file B
Close file C
Delete File A
Delete File B
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Something like:
CFile file1("file1.txt", CFile::modeRead),
file2("file2.txt", CFile::modeRead),
fileTemp("file12.txt", CFile::modeWrite | CFile::modeCreate);
DWORD dwBytesRead;
BYTE buffer[4096]
do
{
dwBytesRead = file1.Read(buffer, sizeof(buffer));
fileTemp.Write(buffer, dwBytesRead);
} while (dwBytesRead > 0);
file1.Close();
do
{
dwBytesRead = file2.Read(buffer, sizeof(buffer));
fileTemp.Write(buffer, dwBytesRead);
} while (dwBytesRead > 0);
file2.Close();
fileTemp.Close();
CFile::Remove("file1.txt");
CFile::Remove("file2.txt");
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thank you so very much. I appreciate the sample code.
sb
|
|
|
|
|
Hi guys
Somebody can explain me what's the procedure to change the app icon for one in 256 colors and that the mini icon in the caption of the main dialog app looks good. The compiler always convert my nice 256 color icon in an ugly icon
Best Regards
Doc
|
|
|
|
|
1. What I do is, get a 256 color icon of the desired size (eg. 32x32 pixels) from the internet.
2. I make a copy of this icon, then open it in DevStudio.
3. I then paste the 256-color image from Paintbrush/Clipboard into the DevStudio icon editor, and save the file.
4. Presto !
HTH
Bikram Singh
I believe we should all pay our tax with a smile. I tried - but they wanted cash.
|
|
|
|
|
(apologies if this is a really noddy question but its been a long day and my brain is fried )
anyway I have created a library from a group of ADA files which used to form a program, I've have also written a C header file which has a list of accessible functions contained in the ada library (done as extern myFuncName ).
I have now tried to use this library in a simple console application which consists of a main.cpp file and has the C header file #included. I have then changed the project settings so that it lists the ada library. Then in my main function i have called
myFuncName ( ) ;
but when it comes to linking the program it comes up as an unresolved external symbol.
Does anyone have any ideas what I'm doing wrong? and also how to remedy it!
I am using MS Visual Studio 6.0.
TIA (off home now )
|
|
|
|
|
Have you used __declspec(dllimport) myfuncName in your H file?
Jaime
|
|
|
|
|
you can try doing this:
extern "C"
{
#include "whatever.h"
}
-c
Software | Cleek
|
|
|
|
|
Does anyone know of a good article that could help me with the following problems? I have a fairly large Visual Studio .Net solution. It is an MFC application with a number of DLLs in addition to the main project that contains the main app's gui.
For some reason, the minimum rebuild feature doesn't work too well. I need to learn more about compile time dependencies and how to avoid recompiling everything every time I change some code and perform a build or a batch build.
If I perform a clean and a build or a rebuild all, then assuming the results are a clean compilation with no errors, shouldn't I be able to run in debug mode immediately? For some reason, if I do a rebuild all of my entire MFC app and all DLLs, and then press F5 to debug, visual studio complains that the DLLs are all out of date and makes me build again. Now once I do a rebuild, followed by a build or batch build, all is okay and subsequent builds seem to be pretty smart and only build the necessary pieces based on what files changed. I don't understand this. If I do a rebuild all, that should be it. Everything should be up to date and performing a subsequent build should result in the output window showing me that all is up to date and none of the projects should recompile.
Any ideas or suggestions on how to solve this issue?
Regards,
Shawn
|
|
|
|
|
Is the following legal C++ code?
try
{
char s[10]="Error";
<br>
if (some condition)
throw s;
}
catch (const char *s2)
{
OutputDebugString(s2);
};
From what I've read I would expect the catch block to receive a pointer to stack memory thats no longer reserved for the variable s. Am I correct?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Steve Thresher wrote:
Is the following legal C++ code?
It appears that throw throws a copy of the data, thus preserving the scope. It is the same concept as constructing an exception in your code and throwing it.
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
Nitron wrote:
It appears that throw throws a copy of the data
Well it of course copies the char* variable but the caught variable contains the same memory address as the thrown variable. So the memory is not copied. Don't know if that is what you meant.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
If you're dealing with objects a copy is made when the object is thrown (using the copy constructor or a shallow copy if a copy constructor is not avaiable) and then the original is destroyed at the end of the try block. When it comes to strings the compiler only knows the address of the string so no copy can be made.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
That is not my understanding. The stack will not begin to unwind until after the exception handler returns.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
If it works, it works due to something that is implementation specific.
In general, I would beat people who made code that depended on that.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
It will probably work, but shouldn't really be used. Instead, you could throw an integer index into an array of strings stored elsewhere, or allocate memory for the string and throw it, then free it in the catch() block.
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"
|
|
|
|
|
I want to program a DLL that would have three entry points. Initialize, DoDialog and Terminate. The Initialize would have a parameter that is a callback into the calling application. DoDialog would have a parameter that would be a Handle to a block of data. When called DoDialog would bring up a dialog and return when the dialog is finished. The data would be modified by the dialog. Terminate would just release things that were allocated in Initialize. So is this possible? Should I do this in MFC, .NET, something else? I also have a fair amount of non-UI C++ code that need to be ported for this dialog as well.
|
|
|
|
|
cgriffin wrote:
Can I do this?
I have no way of knowing that.
palbano wrote:
Can it be done?
Sure
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Sounds reasonable. You can program a DLL to do many things for you as long as you define a good interface. DLLs can contain classes and/or global functions that can be exported so that an application project can link to it. I like to think of DLLs kind of like how I think of classes. You figure out what you want it to do; what kind of logic/common code you want in it and design a good user interface so that other projects can link to the functions and/or classes.
We have a main app project that links to MFC extension DLLs. Use the wizard to create your ext DLLs and it is very simple. In some cases our MFC extension DLLs export class definitions (such as common dialogues). Then the main app can use #include "TheDialogueHeader.h" and then instantiate the dialogue like any other MFC class and implement a modal or modeless dialogue.
We also have DLLs that export a thread function that the application can link to and call by passing the function pointer to AfxBeginThread. Then you have a DLL with a main function that is a thread that will execute along with all of the threads in the Main App project. So your Initialize() func could be a thread or just a function that can be called and will return when finished. If it is a thread, then use the terminate function to implement the signaling logic that will cause the thread(s) in the DLL to terminate for a clean exit.
There are lots of ways to do it but what you are describing seems like a reasonable thing to do. The possibilities are endless and there are many different ways of organizing the code within your DLL. Just like a class, you can have global functions in the DLL or classes that are not exported (private to the rest of the world) that are called by the exported functions/classes (public to the world); and so on and so on.
Have fun!
Shawn
|
|
|
|
|
Thanks for your reply. I was afraid to add too much to the first post so I left out some details. What I am doing is porting code from a Macintosh project. No threading is necessary. The other thing I should mention is that I need to be able to define the dialog after compile time. I have an application that allows the user to design a custom specialized dialog. My application then generates the resources and combines that with the dialog code for the final plugin (Mac version). It seems like it would be too much trouble to write a resource table into the dll. So I was thinking that I could have an external file in my own format, read that and then create the dialog programmatically. Which platform would be best to do that in? If it's .NET is C# required for using .NET? If so then I probably can't go that way as I have to integrate my control/model code from C++.
|
|
|
|