|
I have to send a window handle from my mfc app to my vb dll, so it can postmessage to it. Say I want to get info from this dll so that I can put it into a progressbar in my status bar of my mfc ui. So whose handle shal lI send to the dll? How do I get a hold of this handle in MFC?
Thanks,
ns
|
|
|
|
|
There is GetSafeHwnd and the member var m_hWnd.
m_hWnd is a HWND, the basic Win32 window handle
----------------
Blaster
Computer game programmer and part time human being
http://www.blastersoft.com
|
|
|
|
|
Thanks for that.
But what I also need to know is whose handle do I need? The window I want to send the info is which one? My purpose is to communicate the progress of the VB dll (who is posting the message) to a progress bar that is in the status bar of my MFC MDI app. Would it be the handle of the progress bar. I dont have a feel for this yet...
Thanks,
ns
|
|
|
|
|
I guess the handle to the progress bar directly would be ok. If you have the handle to the dialog, you'd need a way to find the handle to the progress bar and it would bind your vb dll every more to the mfc code, which is bad.
----------------
Blaster
Computer game programmer and part time human being
http://www.blastersoft.com
|
|
|
|
|
Thanks for the info tat the handle is an HWnd. I also see that theres a type calle HANDLE (for objects), and HWnd is for a window. What sthe diffeence between the two? Isnt every window an object? I guess every object si not a window, but if I make a custom class and make an object out of it, is that when I 'd use HANDLE?
Appreciate your help!
Thanks,
ns
|
|
|
|
|
Could some write a sample program in visual C++ for me to compare, The question is as follows:
A metric ton is 35273.92 ounces. Write a program that will read the weight of a bottle of ale in ounces and output the weight in metric tons as well as the number of bottles needed to yield one metric ton of Ale??
Any help would be appreciated
khan_34@hotmail.com
|
|
|
|
|
Nice assignment. You should give it a shot yourself.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
I did give it a shot but the only things thats outputs is the metric ton and not the bottles, here is the program....what am i doing wrong here....
#include <iostream.h>
int main()
{
int ale, bottles, sum, sum1; // declaration
cout << "Weight of bottle of ale in ounces\n"; // prompt at Screen
cin >> ale;
sum = (ale/35273.92);
cout << "Weight of Ale in metric tons is" << sum << endl;
cin >> bottles;
sum1 = ((ale/35273.92) / 35273.92);
cout << "Number of bottles needed for 1 ton of ale are" <
|
|
|
|
|
Atika Khan wrote:
cin >> bottles;
you're waiting for input
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
the Output always gives me 0 bootles, Am I doing the calculation wrong for getting the number of bottles???
|
|
|
|
|
yes. (oz/ton)/(oz/bottle) = bottle/ton
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Thank you very much brian
|
|
|
|
|
Whatever happened to math skills.. no offence.
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
Reminds me of the post a few days back about the significance of math skills in the programming field.
Oh well.
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
no problem, but for future reference, some people around here aren't quite so forgiving. It is after all a programming forum, and not math.
In any case, Good Luck with the C++!!
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
With the risk of being shot by Microsoft or a Java Guru, how do you think that programming has evolved the last 2 years?
Is the majority of applications still written in C/C++ (or even Cobol) or is anyone switching to VB or C#?
And what about Java? Are stilly many programmers switching to Java or has the migration stopped since the burst of the .com bubble?
Does anybody of you know if there any inquiries or reports that can be found on sites?
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
I want to write a small program that copies files to couple directory including Program Files. Is there a function that returns the Program Files location? If there are 2 hard drives and both of them have Program Files folder, which one is returned?
|
|
|
|
|
SHGetSpecialFolderPath.. with
nFolder as CSIDL_COMMON_PROGRAMS, -- look in MSDN.
I think there is only ever 1 real Program Files folder?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
And another way is to get the environement variable named ProgramFiles by just using getenv("ProgramFiles").
But i guess the first method is better
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
If there are 2 hard drives and both of them have Program Files folder, which one is returned?
The one returned by getenv
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
From the registry. Here's a snippet
const char FilesSection[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion";
const char FilesItem[] = "ProgramFilesDir";
char FilesPath[MAX_PATH] = {0};
DWORD size = sizeof(FilesPath);
if(!REG_Get(HKEY_LOCAL_MACHINE, FilesSection, FilesItem, FilesPath, &size))
return(FALSE);
char Temp[MAX_PATH] = {0};
if(!ExpandEnvironmentStrings(FilesPath, Temp, sizeof(Temp)))
return(FALSE);
Todd Smith
|
|
|
|
|
Be warned though you cannot write anything in the Program Files directory if you are running XP, depending on the user profile.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Im writing an MDI app, and I dont want the application to create / show a blank document when the application starts. I know that ProcessShellCommand calls either OnFileNew or OpenDocumentFile (depending on wether a file was specified in the command line). What can I do?
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
In your app's InitInstance, you should see some code like this:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (!ProcessShellCommand(cmdInfo))
return FALSE;
</code>
Add this line to it:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
</code>
By default, m_nShellCommand is set to FileNew, which creates a new document for you automatically when the app starts.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Perfect Thanks...
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|