|
The same principle applies:
Something like:
void CMyView::DoSomething()
{
CMyDialog dlg( this );
for ( each value in database )
{
CString strValue = GetValueFromDataBase();
dlg.AddValue( strValue );
}
if ( IDOK == dlg.DoModal() )
{
// Do something with it
}
else
{
// Panic / shoot user
}
}
class CMyDialog : public CDialog
{
// All the usual stuff
public:
void AddValue(const CString& strValue);
private:
CStringList m_lstValues;
};
void CMyDialog::AddValue(const CString& strValue)
{
m_lstValues.AddTail( strValue );
}
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// Add the values
for ( POSITION pos = m_lstValues.GetHeadPosition() ; pos != NULL ; )
m_lstCtrl.AddString( m_lstValues.GetNext( pos ) );
return TRUE;
}
Dave
|
|
|
|
|
I have a standard window which I use as a aplitter. I want to give the window a beveled look like you get in VC++. I am trapping the WM_PAINT message to draw my own customized window but I dont have any idea ho to get the beveled look like VC++ splitter. What technique should I use to do that. I am not using MFC. Please help.
Also can somebody suggest me any help how to draw XP style menu using Win32.
Thanks in advance
|
|
|
|
|
checkout the DrawEdge() gdi function.
|
|
|
|
|
Hey Folks,
I just got off the phone with the security guy of a large american company who uses our product, who requires that our product transmit data "encrypted" through the pipes.
Currently, our Client-Server application has no encryption whatsoever, when a user logs into our server, the client sends the MD5 hash of the password to the server to be verified, yadda, yadda.
Our customer only requires the logon to be encrypted (the actual data being stored in our product isn't all that sensitive), which makes life easier, but in time, who knows, another customer MAY want the entire session to be encrypted.
With all this stuff new to me for the most part, I did some looking around, and found that CryptoAPI is included in Win2000 etc. Problem is, our product has to run on older platforms too... 95/98/98/NT/2K/XP... Does anyone have any suggestions?
Thanks,
Mike.
|
|
|
|
|
Use Crypto++[^]: robust, lots of documentation, freeware, no export restrictions... it has it all!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When i press a button in my program, i get this message:
Unhandled exception at 0x00ef86a6 in MP3.exe: 0xC0000005: Access violation reading location 0x00000110.
And the strange part is that I get this message even before it has executed any of the procedures for the event of that button. It hasn't even come to the case line
case IDC_CONVERT:
When it pops up with the message.
This only happens if I, before I press the button, press another button which prompts the user to choose an ACM compressor driver. Anyone know what could be wrong? Why does it try to read the location 0x00000110, is that normal?
Here's the assembly code I get redirected to:
00EF86A0 push esi
00EF86A1 mov esi,dword ptr [esp+8]
00EF86A5 push edi
00EF86A6 mov edi,dword ptr [esi+110h] <---- THIS LINE
00EF86AC cmp dword ptr [edi],0FFF88E3Bh
00EF86B2 je 00EF86BC
00EF86B4 pop edi
00EF86B5 mov eax,0FFFFFFFDh
It jumps to the line marked with "THIS LINE".
The value of edi is 24653 and the value of esi and eax is 0.
Please help, I have no idea what could be wrong.
Thankyou in advance.
-Rune Svendsen
|
|
|
|
|
Rune Svendsen wrote:
Unhandled exception at 0x00ef86a6 in MP3.exe: 0xC0000005: Access violation reading location 0x00000110.
Probably one of yout pointers is NULL. You should guard against it.
Use the call stack to find out which of your functions was called last and start from there.
|
|
|
|
|
This one has me totally stumped. How do I hook up the resources for an Extension DLL that in turn calls another Extension DLL? I have tried setting afxCurrentResourceHandle and others. It appears the main problem is the lack of a CWinApp object. I am trying to access some Dialog resources and of course any DoModal loop will fail due to lack of an initialized CWinApp object. This is an ATL exe Server built using CExeModule.
Any help would surely be appreciated.
|
|
|
|
|
You can use extension-style DLL only if .exe links with .dll version of MFC as well. It seems your exe server doesn't.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Thanks for the reply!
It sounds as though my solution would be to create a Regular DLL and export a function that will create the class objects in the Extension DLL. Do you agree with this?
|
|
|
|
|
I'm not sure about the structure of your project. Your COM objects are created by the ATL-based .exe server. What's the role of DLLs? What kind of services are they providing?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Hi Tomasz,
The role of the Exe server is to handle special OPC scanning/communications with a Control System. The Server is designed to run standalone and execute scheduled scan tasks using OPC, but we now have to implement automatic generation of report files that are normally done manually by a user using a client connected to this Server. The report generation objects are located in MFC Extension DLL's that are currently being used by client apps. The need is to execute the existing report objects in the background with hidden windows. My only problem is getting the resource chain initialized properly and I believe your solution to call a Regular DLL will work since it will initialize its own CWinApp object.
Best Regards,
Bill
|
|
|
|
|
Hi.
I have two questions about a dialog based app.
1) How do you add an "About" menu item? For example, a dialog based app features an About class by default. I added a "File" menu. However, the "About" menu does not show up. I could add an "About" menu item, but how do you connect the menu command to the "About" window. In other words, how do you draw the "About" window as the user selects "About?"
2) When you create a dialog based app, AppWizard gives the options to have minimize, maximize, etc. Is there a way to add and/or remove one or more of those features using code? I did not add a feature to minimize, however, now I want to minimize the window. It is too late to use AppWizard.
Thanks,
Kuphryn
|
|
|
|
|
the default code built in is a message handler in the applications .cpp:
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
END_MESSAGE_MAP() and then a function which handles it:
void CMyApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
} of course you have to declare this function in the app's .h file..
not sure about the 2nd question.
-dz
|
|
|
|
|
|
If you want to minimise the window from code (but not put a minimise featuer on your dialog) then post a WM_SYSCOMMAND message with SC_MINIMIZE as wParam.
SendMessage(WM_SYSCOMMAND,SC_MINIMIZE,0);
cheers
Adam.
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
|
|
|
|
|
|
I'm not sure where to ask this question, but i have found no one and no documentation out there that has answered my question in the .Net world. I am using the SourceSafeTypeLib as a reference in a C# project. I am doing a get_version(label) on a particular version of a vssitem. I am returned the object but one of the properties (VersionNumber) causes an "Invalid OLEVERB structure" COMException. Does anyone have any ideas what the problem could be or could someone explain this Exception message to me?
|
|
|
|
|
I want to add feature in my applications to send email silently via outlook express. Any example code you know then please tell me.
Bye Bye
|
|
|
|
|
look here : http://www.codeproject.com/internet/#MAPI[^]
-c
"Kate said / The flowers of intolerance and hatred / Are blooimg kind of early this year / Someone's been watering them.
-- Robyn Hitchcock, Devil's Radio
|
|
|
|
|
Hi there !
An alternative to the excellent articles on MAPI in the corresponding section of this site could be the MSMAPI32.ocx control that installs with VS5.0+, which is documented in MAPI98.CHM. I use it to send emails from JScripts without
using Outlook:
var mapi = new ActiveXObject("MAPI.Session");<br />
mapi.Logon(profileString);<br />
<br />
var message = mapi.Outbox.Messages.Add();<br />
message.Subject = "The message subject";<br />
message.Text = "The message body";<br />
<br />
var recip = message.Recipients.Add();<br />
recip.Name = "me@here.now";<br />
recip.Type = 1;<br />
recip.Resolve();<br />
<br />
message.Send();
You could convert this sample to VC++ using the #import directive and
some COM knowledge, or search the microsoft site for MAPI.Session examples.
Good luck!
Alwin
|
|
|
|
|
Hello again,
I made MCI as child in a dialog(parent) ...
And i play a movie on that ...
I haven't problem in playing the movie ...
But there is strange problem only on WinXP
When i start playing ... i can't see movie on the child window ...
And when i move the parent window(refreshing) then i can see the movie !
What's wrong ...
My guess is OnEraseBkgnd in my parent dialog:
BOOL CElecompDlg::OnEraseBkgnd(CDC* pDC)
{
if(m_hBmp)
{
BITMAP bm;
GetObject(m_hBmp, sizeof(bm), &bm);
HDC hMemdc = CreateCompatibleDC(pDC->m_hDC);
if(hMemdc)
{
HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemdc, m_hBmp);
if(hOldBmp)
{
BitBlt(pDC->m_hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemdc, 0, 0, SRCCOPY);
SelectObject(hMemdc, hOldBmp);
DeleteDC(hMemdc);
DeleteObject(hOldBmp);
return TRUE;
}
else
DeleteDC(hMemdc);
}
}
return CDialog::OnEraseBkgnd(pDC);
}
So, i used Invalidate function for refreshing child window affter i start playing movie in OnInitialDialog, But i still can not see movie in first of running program
Please help me
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I'm not sure what your problem is, but you might want to try setting the "Clip children" style in your parent dialog resource properties.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
GREAAAAAAAAAAT !!!
You are WONDERFUL !!!
You answered all of my questions
Thanks again Joaquín
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I am having some trouble with something that is probably very simple. I have a COM project (exe) and it does not use any ATL. It is fairly simple, a dialog box opens with 2 buttons, the first is to run MS Word. When pressed, word opens up and the user can enter some text. After a lot of research and trial-and-error, I was able to put a button on the Word toolbar. But I do not know how to know when the button has been pressed. This is my class:
/*----------------------------------------------------------------------------*/
const IID IID_IWordAppEventSink = __uuidof(Word::ApplicationEvents);
const IID IID_IWordDocEventSink = __uuidof(Word::DocumentEvents);
const IID IID_ISpecialSaveExit = __uuidof(Office::CommandBarButton);
/*----------------------------------------------------------------------------*/
class CWordEventSink : public CCmdTarget
{
DECLARE_DYNCREATE(CWordEventSink)
public:
CWordEventSink();
virtual ~CWordEventSink();
BOOL Advise(IUnknown* pSource, REFIID iid);
BOOL Unadvise(REFIID iid);
void SetLauncher(CTestDlg* pWordLauncher);
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWordEventSink)
public:
virtual void OnFinalRelease();
//}}AFX_VIRTUAL
protected:
// Generated message map functions
//{{AFX_MSG(CWordEventSink)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Generated OLE dispatch map functions
//{{AFX_DISPATCH(CWordEventSink)
afx_msg void OnAppStartup();
afx_msg void OnAppQuit();
afx_msg void OnAppDocumentChange();
afx_msg void OnDocNew();
afx_msg void OnDocOpen();
afx_msg void OnDocClose();
afx_msg void PSISaveAndExit();
//}}AFX_DISPATCH
DECLARE_DISPATCH_MAP()
DECLARE_INTERFACE_MAP()
private:
CConnectionAdvisor m_AppEventsAdvisor;
CConnectionAdvisor m_DocEventsAdvisor;
CConnectionAdvisor m_BarEventsAdvisor;
CTestDlg* m_pWordLauncher;
};
I kind of cheated by using an example article written by Christian Staffe called Automating and Eventing in Word. But it never mentioned what to do to capture when the button has been pressed. Does anyone have any thoughts or suggestions? Examples would be great to, I am still trying to learn all this COM stuff..........
|
|
|
|