|
I have a program that has many windows that need to be displayed. I am using MFC for the windows. I need to be able to dynamically update the windows from within the program. But I would like them to be displayed in a tab/dockable window fashion. However I can't figure out when you create the window as a property sheet of CFormView how to get access to the object that is created because they have to be created as CRuntimeClass.
Currently for example I just have a bunch of modeless dialog boxes that I instantiate directly and have objects for that I can just call set routines to manipulate the display. I would like to to the same thing just without using modeless dialogs, but CFormview or something similar.
|
|
|
|
|
When I click on the application window's Close X button, it calls my OnClose method. In OnClose, I prompt the user to save the data before closing the application. If the user cancels, I would like the application to remain open as in Microsoft Word, Excel, etc. How do I go about doing this? Thanks.
|
|
|
|
|
don't call the base method, and if the function returns a boolean, return true ( which tells the system you've handled the message, no further processing required ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You can also disable the Close X button of a CWnd derived-object by using CWnd::GetSystemMenu and CMenu::EnableMenuItem on the menu item SC_CLOSE .
For example:
m_MyWndFrame.GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_DISABLED);
|
|
|
|
|
I have a co-worker that created an form in Access 2000. In order to use it every where I need to install MS Access 2000. How can I show this form in MFC and allow the end user to use it without having to install MS Access 2000 on all PC's?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
I have a co-worker that created an form in Access 2000. In order to use it every where I need to install MS Access 2000. How can I show this form in MFC and allow the end user to use it without having to install MS Access 2000 on all PC's?
Sadly you can't. Access forms require MS Access to be installed (or at least the Access Runtime). If you have the correct licencing you can redistribute the MS Access runtime.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I have come across a function that looks like a member function being called but there is no class being declared before it, just the two '::'. How does this work?
Thank-you
|
|
|
|
|
It only means that myFunc isn't in a namespace ("no_namespace"::myFunc).
|
|
|
|
|
It means that the function is part of global namespace.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
i'd like to add a little precision... there are 2 scope operators
- the class scope (class::member )
- the global scope (::global_obj )
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Wrong - there is only 1 scope operator, but there may be 0 or more namespaces or classes, so that without a modifier, the instance refers to the global namespace, i.e. all publically decared functions as might be declared within your own programme or any libraries linked to your programme.
|
|
|
|
|
What's the command to start a program from within my program?
|
|
|
|
|
use WinExec() function
ex :
WinExec("C:\\Path\\program.exe",0);<br />
"Go as far as you can see,and when you get there you’ll see further" - Unknown
|
|
|
|
|
I guess that's what I was looking for, but it doesn't go all the way. For example, I'd like to be able to close my program and have the other one still running. (When attempting this, the window of the other program also didn't become visible.)
|
|
|
|
|
Anonymous wrote:
but it doesn't go all the way
Have you tried ShellExecute?
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
Anonymous wrote:
I'd like to be able to close my program and have the other one still running
CreateProcess will Help in this case, When you use CreateProcess to Execute a Executable, one of it's parameter i.e. LPPROCESS_INFORMATION parameter return with PROCESSID .
Using that Parameter you can control that process i.e.
For terminating the Process :- [TerminateProcess() ]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
From MSDN:
WinExec is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function.
Or alternatively, use ShellExecute, which is a "simpler" function call than CreateProcess.
The StartPage Randomizer
|
|
|
|
|
This code will open a program, open a url, open a file, really open anything that has an associated File Type in the registry and Windows knows what to do with it...and it doesn't matter whether you close your program or not. I only call it OpenURL because that is what I mostly use the function for
BOOL CGlobals::OpenURL(CString csURL)
{
SHELLEXECUTEINFO UrlInfo;
memset(&UrlInfo, 0, sizeof(SHELLEXECUTEINFO));
UrlInfo.cbSize = sizeof(SHELLEXECUTEINFO);
UrlInfo.lpFile = (LPCTSTR)csURL;
// TRUE = explorer/netscape window opened (doesn't check for url connection)
return ShellExecuteEx(&UrlInfo);
}
|
|
|
|
|
// Here's a start:
// Run an external command, optionally waiting around
// for it to finish.
bool RunProgram(LPCTSTR progName, LPCTSTR args,
bool wait /*=false*/, int show /*=SW_SHOWNORMAL*/,
)
{
CString commandLine, userName;
PROCESS_INFORMATION procInfo;
STARTUPINFO startInfo;
memset(&startInfo, 0, sizeof(startInfo));
startInfo.cb = sizeof(startInfo);
startInfo.wShowWindow = (WORD)show;
startInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_FORCEONFEEDBACK;
try
{
// remove leading and trailing spaces
// Trim() is left as an excercise for the reader
commandLine = Trim(progName);
// If there's a space and no double quotes,
// surround the command with double quotes
if (commandLine.Find(' ') >= 0 && commandLine.Find('"') < 0)
commandLine = '"' + commandLine + '"';
commandLine += ' ';
commandLine += args;
LPTSTR lpCommandLine = commandLine.GetBuffer(CommandLine.GetLength() + 32);
if (!CreateProcess(NULL, lpCommandLine, NULL, NULL,
FALSE, 0, NULL, NULL, &startInfo, &procInfo))
return false;
if (wait)
WaitForSingleObject(procInfo.hProcess, INFINITE);
CloseHandle(procInfo.hThread);
CloseHandle(procInfo.hProcess);
}
catch(CMemoryException *)
{
return false;
}
return true;
}
|
|
|
|
|
Hi all,
I need to programmatically enumerate all ODBC drivers installed on a machine. I found some samples, and they work well enough, however I can't find an awful lot of "official" Microsoft documentation on the ODBC APIs themselves.
For example, one of the samples I found uses an API called SQLDrivers(). No problem, it's defined in the latest Platform SDK in sqlext.h. Looking this up in the January 2005 edition of the MSDN library, I'm brought to Servers and Enterprise Development|SQL Server|SQL Server 2000|SDK Documentation|Building SQL Server Applications|ODBC and SQL Server|SQL Server ODBC Driver Programmer's Reference|ODBC API Implementation Details|SQLDrivers, which simply states:
"The ODBC Driver Manager returns all ODBC 3.0-defined SQLDrivers attribute specification strings. For more information about attribute string and value definition, see the ODBC 3.0 documentation."
I'm looking for the actual MS documentation that goes over all the parameters, value returned, possible errors, etc. Where the hell is this??
|
|
|
|
|
I don't think I can help a lot, but maybe you should be looking at SQLBrowseConnect
|
|
|
|
|
> I don't think I can help a lot, but maybe you should be looking at SQLBrowseConnect
I think you misunderstood my question...I don't have any problem enumerating ODBC drivers, per se, but rather I was trying to look for parameter/return value documentation for those SQL*() set of APIs. The section of the MSDN documentation I was looking at essentially describes what the functions do, but do not go into any amount of detail as to what the parameters are, the values returned, error conditions, etc.
For the record, I did find what I was looking for by doing an actual search
It's all under (again, MSDN Library Jan 2005) Win32 and COM Development|Data Access and Storage|Microosft ODBC|Microsoft ODBC|ODBC Programmer's Reference|Part 4 - API Reference|ODBC API Reference.
The funny thing is that with the documentation tree structure opened on both locations, I can see all the same functions being listed twice. Why MS can't organize this better is beyond me...
|
|
|
|
|
Hi,
I'm trying to create a Tooltip control to display tooltip without specifying the hwnd property. Is this possible?
I tried to add a tool to the Tooltip control by specifying the .hwnd property in the TOOLINFO structure as NULL but it doesn't work.
Is it possible in general to display tooltip for application that does not have a Handle?
I read the following post but I don't really understand it as it is in VB:
http://www.codecomments.com/Visual_Basic_Controls/message486687.html
Thanks much - Josh
|
|
|
|
|
Where will your tooltip appear, if you're running a program that doesn't have a window ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
All I want to do is to terminate an application from another application, I can do this by sending wm_close message using postmessage API.
A parameter which postmessage needs is handle to target window this can be found by findwindow, which requires two parameters, window class name or titlebar text. I can't specify title because the title bar text in the target application is not constant. so the only option is window class name.
How can I get window class name of another application, (sdi/mdi), OR
Since the target application is also developed by me how can I set windclss name in that application so that I use same in the terminator applcation.
|
|
|
|