|
I've used the GetMessage( &msg, NULL, 0, 0 ) in the while loop, and the message WM_QUIT was not gotten by the message loop. I used a user defined message to handle this. The previous problem that the thread was killed abnormally was not occurred any more. Maybe the thread killed was another thread but mine...;P
But it may be necessary to Sleep() before posting a message to the thread. Anyway, my problems was solved! Thanks for your guys' help ...
|
|
|
|
|
I found it easy to do thread management with state implementation and synchronization objects .
Engineering is the effort !
|
|
|
|
|
I added a dialog box that can be called from the main window's manu. How can I ninilized some controls? (Edit box, combobox).
The main window has a function
BOOL CMainwindow::OnInitDialog()where I can initilize variables but the dialog does not. It was created with two functions only
CSystem::CSystem(CWnd* pParent /*=NULL*/)
: CDialog(CSystem::IDD, pParent)
{
//{{AFX_DATA_INIT(CSystem)
m_Response = _T("");
//}}AFX_DATA_INIT
}
void CSystem::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSystem)
DDX_Control(pDX, IDC_COMBO1, m_Query);
DDX_Text(pDX, IDC_EDIT1, m_Response);
//}}AFX_DATA_MAP
}
Any help is greatly appreciated
|
|
|
|
|
No Prob Buddy,
Open ClassWizard and Add WM_INITDIALOG message to your application.
let me explain the steps->
1.right click on your dlg class in class view.
2.select window message handller
3.add WM_INITDIALOG message.
i think now you got
BOOL CMainwindow::OnInitDialog()
have fun
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
How to use flash button,flash menu and flash image in vc++??
How to call flash in vc++??
I want to use flashMX in vc++.
What I use dll or ocx??
What control??
pls help me??
|
|
|
|
|
|
me think you can only use a whole flash movie in a vc application, you cannot use individual components within an application.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
First off, I'd like to thank anyone that even reads this.
I have a class called runinfo that holds three strings, company, town, address. In a class called TempRun there is one string, driver.
How do I declare an array of runinfo's in an array of tempruns?
So in final it would be a list of drivers and each driver would have an array of stops?
I tried CArray<CRunInfo,CRunInfo&> obj; but got an error
Once again, thanks for any help
shotgun
|
|
|
|
|
I dunno why you can't do it with CArray, but CArray is crap anyhow. You can definately create a vector of vectors.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Can you do it like this?
<br />
struct SJourney<br />
{<br />
CString m_strCompany;<br />
CString m_strTown;<br />
CString m_strAddress;<br />
};<br />
<br />
class CTempRun<br />
{<br />
CString m_strDriver;<br />
CArray <SJourney, SJourney> m_astJourney;<br />
};<br />
|
|
|
|
|
Can you do it like this?
<br />
struct SStop<br />
{<br />
CString m_strCompany;<br />
CString m_strTown;<br />
CString m_strAddress;<br />
};<br />
<br />
class CTempRun<br />
{<br />
CString m_strDriver;<br />
CArray <SStop, SStop> m_astStop;<br />
};<br />
|
|
|
|
|
Hi,
This isn't a technical question so I'm not sure if it belongs here but I'm not sure where else I could ask, please let me know if I'm in the wrong place.
I want to publish a game that I coded in Visual C++ 6.0. Now what do I need to license in order to publish? Do I need to just have a legally purchased copy of Visual C++? Or do I actually have to have some sort of registered business with a business license?
Thanks!
Kelly Ryan
|
|
|
|
|
No, if you own VC++, then you are fine.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
now I am doing a job to capture the screen and the data format is .bmp,I want to compress it. not save it to bmp file and compress it but convert the data of bmp to data of jpg in memory,what should I do?
thanks a lot
|
|
|
|
|
In memory, it must be a bmp to be of any use to you. To save it to disk as a jpg, you need libjpg, or better yet, use GDI+.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
could you tell me how to do it by GDI+
|
|
|
|
|
Read my articles on GDI+, I present a paint program I called 'doodle' ( so search Code Project for doodle ), which has all the code you need in it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
can you tell me how the Task Manager list processes in system. I have make lots of tests, and found it use neither toolhelp functions or EnumeProcess functions.
I want to drectly create a process that the Task Manager can not find with not using dll injection or remote thread.
regards
|
|
|
|
|
I dont think it's possible to create such process.but you may create a process that can not be killed using task manager(windows service).
|
|
|
|
|
A programm whick access oracle database ,read the data from database and store it in datastruct (user define),then draw pictures by data,It's a long time operation ,so offer a progress bar ,but i can't do it and dont' know how to do it ,can you help me ,give me some idea about it .Thanks!
|
|
|
|
|
The code I posted earlier in the "Cancel button in window not working" thread has an example of a working porgress bar among other things. Only problem is the cancel button won't work :P.
|
|
|
|
|
could u please help me out?
i'm trying to the the value of a html form on OnButtonOK().
but i fail, i'm already about 48 hours on it and i can't find anyone who is beable to help.
i tried news groups, the codeproject.com forum, tek-tips.com.
i tried using msdn, goodle.
bt i can't find good example abut retrieving value from html form
thank for your time.
kind regards,
Marco
// firstw32mfcDlg.cpp : implementation file
//
#include "stdafx.h"
#include "firstw32mfc.h"
#include "firstw32mfcDlg.h"
#include ".\firstw32mfcdlg.h"
#include <atlbase.h>
//#include <afxpriv.h>
#include <oleauto.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// Cfirstw32mfcDlg dialog
BEGIN_DHTML_EVENT_MAP(Cfirstw32mfcDlg)
DHTML_EVENT_ONCLICK(_T("ButtonOK"), OnButtonOK)
DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel)
//DHTML_EVENT_ONCHANGE(_T("email"), OnChangeEdit1 )
//DHTML_EVENT_ONCHANGE(_T("password"), OnEnChangeEdit2 )
END_DHTML_EVENT_MAP()
Cfirstw32mfcDlg::Cfirstw32mfcDlg(CWnd* pParent /*=NULL*/)
: CDHtmlDialog(Cfirstw32mfcDlg::IDD, Cfirstw32mfcDlg::IDH, pParent)
//, m_EDIT1(0)
//, m_EDIT2(0)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void Cfirstw32mfcDlg::DoDataExchange(CDataExchange* pDX)
{
CDHtmlDialog::DoDataExchange(pDX);
DDX_DHtml_ElementInnerText(pDX, _T("email"), EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("password"), EDIT2);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text1"), m_EDIT1);
DDX_DHtml_ElementInnerText(pDX, _T("Temp_Text2"), m_EDIT2);
}
BEGIN_MESSAGE_MAP(Cfirstw32mfcDlg, CDHtmlDialog)
ON_WM_SYSCOMMAND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// Cfirstw32mfcDlg message handlers
BOOL Cfirstw32mfcDlg::OnInitDialog()
{
CDHtmlDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
EDIT1 = AfxGetApp()->GetProfileString("Settings", "email", "your login");
EDIT2 = AfxGetApp()->GetProfileString("Settings", "password", "details here..");
UpdateData(FALSE);
return FALSE; // return TRUE unless you set the focus to a control
}
void Cfirstw32mfcDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDHtmlDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void Cfirstw32mfcDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDHtmlDialog::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR Cfirstw32mfcDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(TRUE);
/*
BSTR bstr = SysAllocString(GetElementText( _T("email")));
CStringW str = bstr;
SysFreeString(bstr);
*/
if(CDHtmlDialog::GetElementText("email"))
{
m_EDIT1=("TRUE");
UpdateData(FALSE);
}
else
{
m_EDIT1=("FALSE");
m_EDIT2=CDHtmlDialog::GetElementText("email");
UpdateData(FALSE);
}
//GetElementText(_T("email"));
//CString strEmail = CDHtmlDialog::GetElementText( _T("email"));
//AfxGetApp()->WriteProfileString("Settings", "email", strEmail.SysAllocString());
//BSTR bstrTable = EDIT1.AllocSysString();
BSTR bstrTable = GetElementText( _T("email"));
CString strEmail = bstrTable;
AfxGetApp()->WriteProfileString("Settings", "email", strEmail);
/*
CComBSTR bstr;
BSTR bstr = SysAllocString(get_innerText( _T("email")));
CString str = CString(bstr);
SysFreeString(bstr);
m_EDIT1=bstr;
UpdateData(FALSE);
*/
//CString strEmail = "email";
//AfxGetApp()->WriteProfileString("Settings", "email", SysAllocString(GetElementText( _T("email"));
//UpdateData(TRUE);
//SysAllocString(EDIT1);
//CString strEmail = "EDIT1";
//AfxGetApp()->WriteProfileString("Settings", "email", strEmail.SysAllocString());
//AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
//AfxGetApp()->WriteProfileString("Settings", "email", );
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//UpdateData(FALSE);
return NULL;
}
HRESULT Cfirstw32mfcDlg::OnButtonCancel(IHTMLElement* /*pElement*/)
{
UpdateData();
if(m_EDIT1)
{
AfxGetApp()->WriteProfileString("Settings", "email", m_EDIT1);
}
else
{
m_EDIT1=_T("i failed");
UpdateData();
}
if(m_EDIT2)
{
AfxGetApp()->WriteProfileString("Settings", "password", m_EDIT2);
}
else
{
m_EDIT2=_T("i failed too");
UpdateData(FALSE);
}
//UpdateData(FALSE);
return NULL;
}
//HRESULT Cfirstw32mfcDlg::OnChangeEdit1(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// //AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
// //AfxGetApp()->WriteProfileString("Settings", "email", "gsdsgj");
//return FALSE;
//}
//HRESULT Cfirstw32mfcDlg::OnEnChangeEdit2(IHTMLElement* /*pElement*/)
//{
// //UpdateData(FALSE);
// ///AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//return FALSE;
//}
|
|
|
|
|
I drawed something in CDC* pDC, now how to get the pointer to array of memory where i drawed.
|
|
|
|
|
Use a DIBSection.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|