|
exported function (inside dll):
getcomponent()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
m_hInThread = AfxBeginThread((AFX_THREADPROC )KIDeviceServiceThreadIn,(PVOID)(CDriver*)this);
}
DWORD WINAPI KIDeviceServiceThreadIn(PVOID pMain)
{
...
pthis->pDocument->UpdateAllViews(); Error use view (when afxMapHWND()==NULL ????;) view - no valid???? but pointer is valid
...
}
|
|
|
|
|
Generally you cannot manipulate the windows from another thread,
this is some thing to do with message pumps.
Try posting a User defined message to the concerned thread and
then Invalidate the Window in that thread from the Message Handler.
|
|
|
|
|
I'm looking for a menu designer and screen designer sample.
Menu designer is just like Visual Studio's one. It lets user to design menu graphically.
Screen designer, just a view that i can move the objects. Any samples i can find, coz I don't know much about GDI.
|
|
|
|
|
Hi all,
I'm working with a Dialog based application.I would like to move a bmp or jpg picture through the bottom of my dialog(say a joker running through the bottom of my dialog) just like a bonzy buddy in which a chimpanzy walks through the bottom of desktop,jumps ,eats a banana etc...
Can any one suggest a method for it?
Shibu K.V.
Senior Research Associate.
VLSI ASIC Hardware Design Group
Electronics R&D Centre,Trivandrum
India
|
|
|
|
|
OnEraseBkgrnd
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Hi,
I'm working with a dialog based application in which the main dialog is used for logon operation.If the user id and password are correct the main dialog is closed(OnOk() is called) and a second dialog is created using DoModal().But the problem is that if i minimise this dialog its icon is not seen on the task bar just like internet explorer window which moves on to the taskbar on minimising it.In my application if i minimise my dialog the title bar of my dialog gets minimised and it moves on to the left corner of my screen and no information about that window is available on the task bar.How can i rectify it?
Shibu K.V.
Senior Research Associate.
VLSI ASIC Hardware Design Group
Electronics R&D Centre,Trivandrum
India
|
|
|
|
|
Here's how to give a sub-dialog it's own icon
in the constructor of your sub dialog class
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
and in the dialog's ::OnInitDialog
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
Override the dialog's ::OnPaint
void CMyDialog::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
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;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
And finally, as a protected member of the dialog class:
HICON m_hIcon;
All of this will have been done automatically for your main dialog by the MFC AppWizard
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
I think you should consider the design of the program. You seem to go about the business backwards.
My suggestion is to open a modal dialog (the log-on dialog) from the OnInitDialog function of your main app. Your main app will then be displayed after returning from the log-on dialog.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
'It is so much simpler to bury reality than it is to dispose of dreams.'
- Don Delillo, Americana
|
|
|
|
|
hi
Got ur problem...u hav 2 dialogs..and in a dialog based app u make ur default dialog login dialog and u create another dialog class to process after the login...the MFC gives all th esupporting code in to the first dialog ..and u want the same for second dialog..so u ask for some code for the minimisation and icon in Taskbar...there is no need of that..u just make the first dialog(MFC give al supporting code)as the dialog after login and u just create a second dialog class and use that in ur OnInitDialog() of the first..problem solved..!!!
"Eliye pedichu illam chudano"???
Renjith-The CPian.
|
|
|
|
|
Hi,
MS Word Automation, If I call the method PageSize, I get the output in inches, how can I get it in Milimeters or Himetric ?
Thanks in advance, greetings
Braulio
PS.: I HATE INCHES !!!! :-P
|
|
|
|
|
|
It seems that not, I don´t know why but it seems that Ms Word makes something strange there
Thanks
Braulio
|
|
|
|
|
somewhere on the web, i thought it was here on codeproject but i dont know it really anymore
i found an article frome someone who used a CFile and make it own crypted version of it and make it usable with CArchive. Did someone know this article. I dont find it anymore.
|
|
|
|
|
i am creating activex combobox using visual c++. i am facing one prob... i would like to know how to resize the combobox corresponding to its fontsize. whenever the fontsize or fontchanges the control has to resize not only the edit portion also the dropdown portion.
thanks in advance.
Shanker
|
|
|
|
|
I want to code a spreadsheet program in DOS mode, can anyone suggest some source code? Thanks!
|
|
|
|
|
I created an MDI application. I dynamically create the document, and the child frame in an MDI applicaiton. However, the title bar in the MDI child frame is empty. I tried use pFram->SetWindowText(myTitle), but it doesn't work. How can I set the title for an MDI child frame programatically ?
|
|
|
|
|
Try this:
CDocument::SetTitle(LPCTSTR lpszTitle)
|
|
|
|
|
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.style &= ~(LONG) FWS_ADDTOTITLE; // add your source code!!!
// and u use SetWindowText!!!
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
|
|
|
|
|
I have some code to read the partition table. The structure is supposed to be 512 bytes to read from the disk and I have translated from the Pascal code the following structure to c++:
(The pascal code works fine as it is 512 bytes)
TPartEntry = record
boot_ind : Byte;
head : Byte;
sector : Byte;
cyl : Byte;
sys_ind : Byte;
end_head : Byte;
end_sector : Byte;
end_cyl : Byte;
start_sect : UINT;
nr_sects : UINT;
end;
TDiskTable = record
Data : array[1..446] of Char;
Table : array[1..4] of TPartEntry;
Signature : WORD;
end;
... to get this...
typedef struct tagPARTENTRY
{
BYTE bBoot;
BYTE bHead;
BYTE bSector;
BYTE bCyl;
BYTE bSysInd;
BYTE bEndHead;
BYTE bEndSector;
BYTE bEndCyl;
UINT unStartSect;
UINT unNumSects;
} PARTENTRY;
typedef struct tagDISKTABLE
{
CHAR cData[446];
PARTENTRY tTable[4];
WORD wSignature;
} DISKTABLE;
When I do a sizeof(DISKTABLE) it returns a size of 516 bytes. When I manually add up the values I get 512 bytes. Where are the other 4 bytes coming from and what am I doing wrong?
Cheers,
Clint
|
|
|
|
|
Alignment issues, I guess. Try enclosing the definition of the structure between alignment #pragma s like this:
#pragma pack(push,PREVIOUS_PACK_VALUE,1)
...
#pragma pack(pop,PREVIOUS_PACK_VALUE)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have never used the #pragma pack and documentation is a little obscure as to how to use it. I was wondering if you could give me an example based on my sampel code which I provided in my previous post.
Thanks in advance!
Clint
|
|
|
|
|
Thanks for you help. I figured out how to use the #pragma pack and it did the trick. You can just ignore the last reply. Thanks again.
Cheers,
Clint
|
|
|
|
|
hi,
is it neccessary to clear or delete the handle from CreateEvent()?
if i just create a new HANDLE and hold with variable holding previous HANDLE from CreateEvent(), will there anything wrong after long run?
thanks,
jim
|
|
|
|
|
you need to close any handles you dont need
explicitly by using CloseHandle or by using any
function with respect to the particular operation
you are doing which properly releases the resources.
|
|
|
|
|
hi,
do you any method that i can check whether my event object still be in the kernel if i don't execute CloseHandle()?
in my case, i run CreateObject again and again, and put the return handle to cover the previous handle. so, i don't know the previous event object has been destroyed in kernel or not.
do you know any tools to check about this?
|
|
|
|