|
use the virtual database list idea
see
http://www.codeguru.com/mfc_database/virtual_dblist.shtml
Its seems to have the answer you want
|
|
|
|
|
I need to know what browser is the default browser and in what directory is located, so I can call ShellExecute to open some html pages but NOT in the same window. So I guess this information must be stored into the registry, right? So in what keys?
|
|
|
|
|
How do you want to force opening .html in new window? Are there any commandline switches you're going to pass to ShellExecute?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I'm gonna say instead of ShellExecute(..,"open","page.html",...) wich opens the pages in same windows. ShellExecute(..,"open", "Path_got_from_registry:\\iexplore.exe page.html",...). It opens the pages in separate windows. That I know!
|
|
|
|
|
|
There is no such parameter as openew to pass to ShellExecute. It's not a smart builed function if u ask me!
|
|
|
|
|
There is no such parameter as openew to pass to ShellExecute.
You're passing plain string as a verb to ShellExecute. 'opennew' is registered as a .html verb, at least on my W2K machine.
It's not a smart builed function if u ask me!
Sure. Microsoft should hire you as a consultant.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
Call
RegQueryValueEx(...)
with
HKEY_CLASSES_ROOT,
"http\\shell\\open\\command",
"(Default)"
and you should get the path to the application browser running as default.
/Tommy
|
|
|
|
|
debug version with execute works fine
debug version with debug/run crashes at start
what can be reason?
thanks for ideas
t!
|
|
|
|
|
debug version with debug/run crashes at start
What's on the stack when program crashes? You should be able to see where exactly your program crashed.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
thanks very much for interest
we found it
believe or not i depended on disabled breakpoint, after its removing it starts fine
t!
|
|
|
|
|
Hi,
I have taken some RTF in my applicaiton and pasted (using the old way... no COM...) into word ( if you want I can "paste" this little code, just not pasted to avoid boring you), the questions that I have are:
- Is possible to free that thing entered in the clipboard after paste it ?, I have:
memcpy(pGStr, (const void *) pConstBuf, CellInfo.Text.GetLength());
pConstBuf = NULL;
TempStr.ReleaseBuffer();
GlobalUnlock(hGlobal);
SetClipboardData(lRTF, hGlobal);
CloseClipboard();
GlobalFree(hGlobal);
range.Paste();
// After this range.Paste()
- The other question is... I´m freeing the things right ( if needed I send the whole little thing ).
Thanks, for your pattience and your time..., Bye !
Braulio
|
|
|
|
|
I have a program that displays all files in a specified directory in my own version of a list control. There is also a button that allows the operator to open any of the files which is achieved by the following command:
ShellExecute(NULL,"open",filename,NULL,path,SW_SHOW)
For .txt documents a copy of notepad is opened on top of my application which is what I would expect. However for .doc files a copy of Word2000 is opened on top of my application while the document is loaded but then Word disappears behind my application once the document is loaded. Does anybody have any ideas why this would happen? I have tested several other types such as .jpg files which open in Paint Shop Pro behind my application window and .zip files which open in WinZip on top of my application window.
Any suggestions about this problem would be greatly appreciated.
Steve.
|
|
|
|
|
It may depend on how program associated with given extension communicates with the shell. Word uses DDE by default, while notepad and WinZip do not - this may be the difference. You can change that in 'File types' property page of folder options.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Steve:
This work fine.
ShellExecute(NULL,"open","C:\\temp\\Test.doc",NULL,"C:\\temp",SW_SHOW );
If it don't work in your PC, try opening a .doc file from Explorer.
Is you got the some problem, then chek your .doc file Registry assosiation.
|
|
|
|
|
why we use multibyte character?
and is TCHAR is a multibyte character?
What is the relation between it and the unicode?
Thx.
|
|
|
|
|
Depending on your compiler directives TCHAR is either a char or a wchar_t.
if you define UNICODE, the preprocessor changes TCHAR to a wchar_t (a wide char), else it's just a standard char.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hello, could someone give an example of how to place a dialog in a dll and then howto create that dialog from my MFC-app?
|
|
|
|
|
Your dll must be an MFC Extension DLL, not a normal one.
Create a new project with AppWizard and indicate MFC AppWizard(dll), then MFC Extension DLL.
your DllMain must look like this
static AFX_EXTENSION_MODULE EcamecExtDLL = { NULL, NULL };
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Remove this if you use lpReserved
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
// Extension DLL one-time initialization
if (!AfxInitExtensionModule(EcamecExtDLL, hInstance))
return 0;
// Insert this DLL into the resource chain
// NOTE: If this Extension DLL is being implicitly linked to by
// an MFC Regular DLL (such as an ActiveX Control)
// instead of an MFC application, then you will want to
// remove this line from DllMain and put it in a separate
// function exported from this Extension DLL. The Regular DLL
// that uses this Extension DLL should then explicitly call that
// function to initialize this Extension DLL. Otherwise,
// the CDynLinkLibrary object will not be attached to the
// Regular DLL's resource chain, and serious problems will
// result.
new CDynLinkLibrary(EcamecExtDLL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
// Terminate the library before destructors are called
AfxTermExtensionModule(EcamecExtDLL);
}
return 1; // ok
}
#endif
// MyDlgInclude.h
#ifdef _WINDLL
#include "resource.h"
#define DLL_FUNCTION __declspec(dllexport)
#else
#define DLL_FUNCTION __declspec(dllimport)
#endif
Then declare your Dialog class using one of this diferent approach
1- Export only the class metod you will use in your app
class CMyDlg : public CDialog
{
public:
MY_AFX_EXT_CLASS CMyDlg();
MY_AFX_EXT_CLASS int DoModal();
// Dialog Data
//{{AFX_DATA(CMyDlg)
enum { IDD = 100 };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CMyDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
2 - Export the whole class
class MY_AFX_EXT_CLASS CMyDlg : public CDialog
{
public:
CMyDlg();
int DoModal();
...... // same code
};
// MyApp.cpp
#include "MyDlgInclude.h"
CMyDlg nDlg;
nDlg.DoModal();
|
|
|
|
|
The *requirement* to be an extension DLL is not true at all. You can also use a regular DLL and invoke the dialog box through an exported function.
|
|
|
|
|
Hello, I have a problem reading a string from the registry (Windows CE)
I created two value's with the remote registry editor.
UserLevel:REG_DWORD:0x01
ProgUnitID:REG_SZ:696969
here's a snippet
DWORD UserLevel;
CString ProgUnitID;
//TCHAR ProgUnitID;
DWORD type;
DWORD size = sizeof(DWORD);
int result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\GinaII"),
NULL,KEY_ALL_ACCESS,&hKey);
if(result==ERROR_SUCCESS)
{
RegQueryValueEx(hKey,_T"(UserLevel"),NULL,&type,(BYTE*) &UserLevel,&size); // works well, function returns 0
RegQueryValueEx(hKey,_T("ProgUnitID"),NULL,&type,(BYTE *) &ProgUnitID,(DWORD*)(sizeof(TCHAR)*6)); // function returns 0
Result:
UserLevel=1
ProgUnitID={""}
What am I doing wrong here?
Arjan
|
|
|
|
|
I think your ReqQueryValueEx has failed with a error. Your parameters are wrong.
Try
TCHAR szProgUnitID[32];
DWORD dwProgSize = 32;
long lResult = RegQueryValueEx(hKey,_T("ProgUnitID"),NULL,&type,(LPBYTE) szProgUnitID,&dwProgSize);
|
|
|
|
|
try with this function
ReadString(LPCTSTR SectionName, LPCTSTR KeyName, LPTSTR Value, DWORD BufSize, LPCTSTR DefaultValue, HKEY key)
{
RegCreateKeyEx(key, SectionName, 0, NULL, 0, KEY_READ, NULL, &hkey, &KeyAction);
if (RegQueryValueEx(hkey, KeyName, NULL, NULL, (byte*)Value, &BufSize) != ERROR_SUCCESS)
_tcscpy(Value, DefaultValue);
}
ReadString(_T("software\\test"), _T("keyname"), Buffer, BufferSize, _T("Default Value"), HKEY_CURRENT_USER);
I have used this a lot under CE.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Accepting the lack of error handling, shouldn't you use
_tcsncpy(Value, DefaultValue, BufSize); rather than
_tcscpy(Value, DefaultValue);
Gavin
|
|
|
|
|