|
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
|
|
|
|
|
After RegOpenKeyEx()...
Try this :
_TCAHR *ProgUnitID;
if(result==ERROR_SUCCESS)
{
DWORD dwcMaxValueData;
RegQueryInfoKey (hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &dwcMaxValueData, NULL, NULL);
ProgUnitID = new _TCHAR[dwcMaxValueData] ;
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));
}
Prasanna
|
|
|
|
|
RegQueryValueEx(hKey,_T("ProgUnitID"),NULL,&type,(BYTE *) &ProgUnitID,(DWORD*)(sizeof(TCHAR)*6));
The problem is (DWORD*)(sizeof(TCHAR)*6) . That parameter is not a pointer to a DWORD variable. Reset size to sizeof(TCHAR)*6 and pass &size .
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
Hey!
I recently experienced a weird List View behavior.
I subclassed the control and then set it to Report mode. Then I wrote some code that logs WM_LBUTTONDOWN and WM_LBUTTONUP messages to a file, whenever they are received in the subclassed procedure - before forwarding it to the original control's procedure.
I noticed that when I click on an item in the control, only WM_LBUTTONDOWN is received. (When I click on other part of the client area a WM_LBUTTONUP is also received).
Why, and how does it happen?
Actually I came across all that, trying to solve some text alignment related problem. I wanted to have a right-aligned list - but the List View control doesn't support the right-align attribute of the leftmost column. So I tried doing like the documentation suggested, inserted a dummy column, then the actual column as column 1, and finally removed the dummy column. This right-aligned the items in the list, but I had to click the left part of the control to select them - as if they were on the left! So I tried to replace the LPARAM of every WM_... mouse message to a number that defines coordinates as if the user actually did click on the left part of the control. This worked fine, until I tried to catch the NM_CLICK message. The List View control didn't send it when I clicked the right part of the control, and this got me investigating... If you have any idea, please share it
Thanks!
|
|
|
|
|
List control enters modal message loop after pressing the mouse button. Here's what MSDN says:
WM_LBUTTONDOWN: Processed in different ways depending on whether a click or drag operation is being initiated. To determine which operation is involved, the list view control enters a modal message loop until either the button is released or the mouse is moved.
This means that WM_LBUTTONUP will not get through message loop of your application.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thank you very much!
I will now resort to MSDN to read what exactly "modal message loop" is
|
|
|
|
|
Hi,
I am using MFC(singledocument) to display some 3D physical simulation with OpenGL. My problem is that the display is really slow when my display-window is large. Does anyone have any good ideas on how to speed up the display? The graphics is really simple, (i.e not photographic).I only need 8bit colors. For the smoothness of animation I need doublebuffering, but antialiasing is already turned off. Often only small parts of the window changes between frames. Is it possible to redraw only parts of the screen? I have also tried different settings for the pixelformat, f.x lowering the colordepth etc, but that has not made any large impact. Any ideas on the topic is welcome. Thanks.
JoNy
|
|
|
|
|
Are you SURE you're finding your 3d hardware correctly?? Perhaps your app isn't initializing OpenGL correctly, and you're ending up with the software implementation??
|
|
|
|
|
Thanks,
how do I check if the application finds the 3d hardware?
/JoNy
|
|
|
|
|