|
You mean, must be six characters long ? How do you have it stored ? All string classes have some sort of length function. If you want numbers AND letters, you'll have to iterate over the string looking for both.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I'm not taking the password programmatically.I need to enable the option in the Windows 2000 settings programmatically.The setting is in the Administrative Tools,which I need to enable thru my program.
Learning is a never ending process of Life.
|
|
|
|
|
Hi, I have a little system tray application. Now I need to add a options dialog and I also like to give it a hotkey.
How can I add a accelerator to my main frame? I never did this before. When a hotkey is pressed it should send a WM_COMMAND (wParam ID_APP_OPTIONS) to my main frame (which then will create the dialog).
Thanks for help!
|
|
|
|
|
There should be an accelerator table in your ResoureView tab. Use the editor to add a new key with the id ID_APP_OPTIONS. If there isn't a table there, add one and make sure its id is IDR_MAINFRAME.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
i have an int and i want to convert it int CString and write it into a file through CFile or file pointer how to write it?
any body plz write the complete syntex of it ?
r00d0034@yahoo.com
|
|
|
|
|
CString s;
int i = 0;
s.Format("%d", i);
CFile, you're on your own. MFC file stuff is crap, I use iostreams.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
One solution for writing a CString to a file using MFC is CStdioFile.
CStdioFile output(filename, CFile::modeWrite | CFile::modeCreate);
output.WriteString(CStringObject)
Kuphryn
|
|
|
|
|
Please help me hoe to Override ExitInstance() in VS.net?
|
|
|
|
|
you could write an addin for VS.NET and act on the
OnBeginShutdown event.
But I don't think it's possible to override ExitInstance directly.
|
|
|
|
|
any body tell me how to convert a int into CString
so that i can seen the character of int ?
any body tell me how to convert a int into String
so that i can seen the character of int ?
r00d0034@yahoo.com
|
|
|
|
|
CString s;
int i = 82;
s.Format("%i",i);
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
im developing with visual c++.net.. and am wondering how to set the background of a label so that it is transparent.
xai
|
|
|
|
|
ummm, sorry
from->BackColor = Color::Transparent;
i should have known..
xai
|
|
|
|
|
I got some weird bug on my system where it keeps doing a reboot (not BSOD). Is there a way to track which process is calling InitiateSystemShutdown?
This is weird. I found this in Event Viewer
The process winlogon.exe has initiated the restart of WS-176 for the following reason: No title for this reason could be found
Minor Reason: 0xff
Shutdown Type: reboot
Comment:
Todd Smith
|
|
|
|
|
|
Right click on the solution name or sub-project name in the Solution Explorer and select 'Rename'.
Or, select the desired item and change it's name in the property window.
Nick
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
|
|
|
|
|
First, I have read all the post concerning plugins. Most tell you to use COM. So lets start with NO COM. Please. I have 3 functions I want to support dlls in. They are all simple functions, pass data, get data back. I only need one dll per function to be loaded at a time. The dll's will need to register themselves on install, and the user can select what dll they want to use. What is the simplest way to do this. I was once told that as long as you keep the same functions exported in each dll, same input/output data types, that all you need to do is to load whatever dll you want. Please confirm this. OK I will digress to keep this from getting to long. Please help.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
Darroll wrote:
I was once told that as long as you keep the same functions exported in each dll, same input/output data types, that all you need to do is to load whatever dll you want
Yes. Use LoadLibrary with correct path, then GetProcAddress with function name.
Of course, there's number of things to remember - for example, if you're linking statically with CRT, then your dll shouldn't free blocks allocated in exe and vice versa.
Tomasz Sowinski -- http://www.shooltz.com
*** Vodka. Connecting people. ***
|
|
|
|
|
Darroll wrote:
I was once told that as long as you keep the same functions exported in each dll, same input/output data types, that all you need to do is to load whatever dll you want.
Yes, that's right. You can load the DLL chosen at runtime using LoadLibrary. Instead of registering the DLLs, I scan a program directory for DLLs at startup using Version Info resource to sort the DLLs by categories.
Example:
typedef int (CALLBACK* LPDLLMYFUNC)(char *data);
...
HINSTANCE hDLL = LoadLibrary(dllpath);
int res;
char data[] = "bflmpsvz";
if (hDLL != NULL)
{
LPDLLMYFUNC lpfnDllFunc = (LPDLLMYFUNC)GetProcAddress(hDLL,"MyFunc");
if (lpfnDllFunc)
{
res = lpfnDllFunc(data);
}
FreeLibrary(hDLL);
}
You need to export the function int MyFunc(char *data) from your DLL.
Pavel
Sonork 100.15206
|
|
|
|
|
I am currently writing an MFC extension DLL to handle plug-ins. It should hopefully be finished some time in the next few weeks. It will have all the bells n whistles, but it sounds like you need a very small sub-set of options. Th best bet would be to write a DLL wrapper class which can be passed a filename of a DLL, loads it, gets all the function pointers and such and allows you to call from it. As an example, here is some of the code from my library that does this. It may be of help.
#ifndef CDLLwrapper_included
#define CDLLwrapper_included 1
class CMyMultiDocTemplate ;
typedef int (* GETDOCUMENTTEMPLATECOUNT)() ;
typedef CMyMultiDocTemplate* (* GETDOCTEMPLATE)(int index) ;
typedef void (* INITIALISEDLL)(CWinApp *pApp) ;
typedef void (* RELEASEDLL)() ;
typedef AFX_MSGMAP* (* GETPREMESSAGEMAP)(LPCTSTR pClassname) ;
typedef AFX_MSGMAP* (* GETPOSTMESSAGEMAP)(LPCTSTR pClassname) ;
class _PLUGIN_API CDLLWrapper
{
public:
CDLLWrapper() ;
CDLLWrapper(CString& filename) ;
CDLLWrapper(CDLLWrapper& other) ;
virtual ~CDLLWrapper() ;
bool LoadDLL(CString filename) ;
bool FreeDLL() ;
CDLLWrapper& operator=(CDLLWrapper& other) ;
void InitialiseDLL(CWinApp *pApp) ;
void ReleaseDLL() ;
int GetDocTemplateCount() ;
CMyMultiDocTemplate* GetDocTemplate(int index) ;
AFX_MSGMAP* GetPreMessageMap(LPCTSTR pClassName) ;
AFX_MSGMAP* GetPostMessageMap(LPCTSTR pClassName) ;
private:
CString m_filename;
HINSTANCE m_DLLhInstance ;
INITIALISEDLL m_pFNInitialiseDLL ;
RELEASEDLL m_pFNReleaseDLL ;
GETDOCUMENTTEMPLATECOUNT m_pFNGetDocTemplateCount ;
GETDOCTEMPLATE m_pFNGetDocTemplate ;
GETPREMESSAGEMAP m_pFNGetPreMessageMap ;
GETPOSTMESSAGEMAP m_pFNGetPostMessageMap ;
} ;
#endif // CDLLwrapper_included
#include "stdafx.h"
#include "DLLwrapper.h"
#include "MyMultiDocTemplate.h"
CDLLWrapper::CDLLWrapper()
{
m_DLLhInstance = NULL ;
m_filename = "" ;
m_pFNGetDocTemplateCount = NULL ;
m_pFNGetDocTemplate = NULL ;
m_pFNInitialiseDLL = NULL ;
m_pFNReleaseDLL = NULL ;
m_pFNGetPreMessageMap = NULL ;
m_pFNGetPostMessageMap = NULL ;
}
CDLLWrapper::CDLLWrapper(CDLLWrapper& other)
{
*this = other ;
}
CDLLWrapper::~CDLLWrapper()
{
FreeDLL() ;
}
bool CDLLWrapper::LoadDLL(CString filename)
{
m_filename = filename ;
m_DLLhInstance = LoadLibrary(filename) ;
if (m_DLLhInstance != NULL)
{
m_pFNGetDocTemplateCount = (GETDOCUMENTTEMPLATECOUNT)GetProcAddress(m_DLLhInstance, "GetDLLDocTemplateCount") ;
m_pFNGetDocTemplate = (GETDOCTEMPLATE)GetProcAddress(m_DLLhInstance, "GetDLLDocTemplate") ;
m_pFNInitialiseDLL = (INITIALISEDLL)GetProcAddress(m_DLLhInstance, "InitialiseDLL") ;
m_pFNReleaseDLL = (RELEASEDLL)GetProcAddress(m_DLLhInstance, "ReleaseDLL") ;
m_pFNGetPreMessageMap = (GETPREMESSAGEMAP)GetProcAddress(m_DLLhInstance, "GetPreMessageMap") ;
m_pFNGetPostMessageMap = (GETPOSTMESSAGEMAP)GetProcAddress(m_DLLhInstance, "GetPostMessageMap") ;
}
return (m_DLLhInstance != NULL) ;
}
bool CDLLWrapper::FreeDLL()
{
if (m_DLLhInstance != NULL)
{
FreeLibrary(m_DLLhInstance) ;
m_DLLhInstance = NULL ;
m_filename = "" ;
m_pFNGetDocTemplateCount = NULL ;
m_pFNGetDocTemplate = NULL ;
m_pFNInitialiseDLL = NULL ;
m_pFNReleaseDLL = NULL ;
m_pFNGetPreMessageMap = NULL ;
m_pFNGetPostMessageMap = NULL ;
}
return true ;
}
CDLLWrapper& CDLLWrapper::operator=(CDLLWrapper& other)
{
FreeDLL() ;
m_filename = other.m_filename ; other.m_filename = "" ;
m_DLLhInstance = other.m_DLLhInstance ; other.m_DLLhInstance = NULL ;
m_pFNGetDocTemplateCount = other.m_pFNGetDocTemplateCount ; other.m_pFNGetDocTemplateCount = NULL ;
m_pFNGetDocTemplate = other.m_pFNGetDocTemplate ; other.m_pFNGetDocTemplate = NULL ;
m_pFNInitialiseDLL = other.m_pFNInitialiseDLL ; other.m_pFNInitialiseDLL = NULL ;
m_pFNReleaseDLL = other.m_pFNReleaseDLL ; other.m_pFNReleaseDLL = NULL ;
m_pFNGetPreMessageMap = other.m_pFNGetPreMessageMap ; other.m_pFNGetPreMessageMap = NULL ;
m_pFNGetPostMessageMap = other.m_pFNGetPostMessageMap ; other.m_pFNGetPostMessageMap = NULL ;
return *this ;
}
void CDLLWrapper::InitialiseDLL(CWinApp *pApp)
{
if (m_pFNInitialiseDLL != NULL)
{
m_pFNInitialiseDLL(pApp) ;
}
}
void CDLLWrapper::ReleaseDLL()
{
if (m_pFNReleaseDLL)
{
m_pFNReleaseDLL() ;
}
}
int CDLLWrapper::GetDocTemplateCount()
{
if (m_pFNGetDocTemplateCount)
{
return m_pFNGetDocTemplateCount() ;
}
return 0 ;
}
CMyMultiDocTemplate* CDLLWrapper::GetDocTemplate(int index)
{
if (m_pFNGetDocTemplate)
{
ASSERT(index >= 0) ;
ASSERT(index < GetDocTemplateCount()) ;
return m_pFNGetDocTemplate(index) ;
}
return NULL ;
}
AFX_MSGMAP* CDLLWrapper::GetPreMessageMap(LPCTSTR pClassName)
{
if (m_pFNGetPreMessageMap)
{
return m_pFNGetPreMessageMap(pClassName) ;
}
return NULL ;
}
AFX_MSGMAP* CDLLWrapper::GetPostMessageMap(LPCTSTR pClassName)
{
if (m_pFNGetPostMessageMap)
{
return m_pFNGetPostMessageMap(pClassName) ;
}
return NULL ;
}
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Wow, please keep me in mind when you release this. My Email is darrollwalsh@hotmail.com. Send me a copy when you post it. I was only keeping it simple because of my lack of knowlade in using plugins. I think I will be able to expand my app when you let this baby out. Just add how to add it to an existing DLG app. Thatnk in advance.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
i've put an HWND created by IShellView:CreateViewWindow in a CView. when i resize the window, the display is broken, especially when i set the view to DETAILS, and resize the windows horizontally : the display of the right-hand scrollbar is broken.
you can easily try it by creating an MFC appwizard project, SDI, and use CHtmlView as base class for the view class. in the view .cpp file, change the line :
Navigate2(_T("http://www.microsoft.com/visualc/"),NULL,NULL);
to :
Navigate2(_T("c:\\"),NULL,NULL);
you won't even have to set to DETAILS mode, just resize the window horizontally and you'll see right-hand scrollbar won't be displayed correctly.
how to correct this ? (no one will have the answer i'll bet)
|
|
|
|
|
I've had a similar problem with another activeX control, the scrolbar disapears when you resize.
I added
::RedrawWindow('HWND OF YOUR WINDOW',NULL,NULL,RDW_FRAME |RDW_ERASE|RDW_INVALIDATE|RDW_ALLCHILDREN );
After the MoveWindow function, it seemed to get it alright.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
thank you very much.
i've also added your line in the OnDraw function because i also got the problem when the application starts...
|
|
|
|
|
Anyone has any idea how to initialize a listbox with file names matching a given criterion? I'd like the listbox to display all .txt files in a directory. Thanks,
Ralf.
ralf.riedel@usm.edu
|
|
|
|