|
I want to make an app that write some text on the taskbar. But everytime WM_PAINT is handled I have to re paint it. My question is how I can hook the taskbar and get notified when WM_PAINT is handled.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Put the app in a DLL that also contains a basic COM object. Use the SHLoadInProc() function to cause the DLL to be loaded into explorer's address space and an instance of the COM object to be created. In the initialisation of this object, you can subclass the taskbar and handle whatever messages you need. Use spyxx to find the window structure so you can find the taskbar at runtime.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
Hope this helps
Yeah god damnit!
I just have to learn hom to create a COM object...
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Hi,
I would like to know how I can create a shortcut of a file and put that on the desktop from my MFC sdi application?
|
|
|
|
|
Hi,
See the article how to create IShellLink in Desktop
http://www.codeproject.com/shell/desktopshortcut.asp
With Regards,
R.Selvam
|
|
|
|
|
how to modify system path?
Hi,
How can I modify the system verables (and user variable) PATH from my MFC application?
|
|
|
|
|
Hi,
I am trying to add and edit records to MS Access database from a dialog box. I created a dialog box by using AppWizard. Also, i created a derived class of CRecordset by using ClassWizard. The following is my ONOK function:
void CComplaintDlg::OnOK()
{
// CDatabase complaints;
//complaints.OpenEx("DSN=Complaints",CDatabase::noOdbcDialog);
// complaints.Open("Complaints");
// complaintRecord cr(&complaints);
complaintRecord cr;
cr.Open();
cr.MoveLast();
if(!cr.CanUpdate())
AfxMessageBox("dd");
cr.AddNew();
UpdateData();
cr.m_CallerName = m_Complaint_Name;
cr.Update();
cr.Requery();
cr. Close();
CDialog::OnOK();
}
After i compile and run it, it does not update the data file. What did i do wrong?
Thanks in advance.
csgogogo
|
|
|
|
|
Hi,
you can try the following way,
CDaoDatabase m_db ;
CDaoRecordset *m_set ;
COleVariant m_var ;
CString m_str ;
m_db.Open ( "sample.mdb" ) ;
m_set = new CDaoRecordset ( &m_db ) ;
m_set -> Open ( dbOpenDynaset, "select * from table" ) ;
m_set -> MoveFirst( ) ;
m_set -> Edit( ) ;
UpdateData( TRUE ) ;
m_set -> SetFieldValue( "complientname",( LPCSTR ) m_Complaint_Name) ;
m_set -> Update( ) ;
With Regards,
R.Selvam
|
|
|
|
|
Hello,
I have a dialog based mfc program under VBC++6.0, and I am trying to create a new dialog that pops up and displays the status of my program. In other words, I have my main dialog with a button on it, and when you push that button a loop begins. The loop makes a simple calculation and then pauses for 300ms before looping back to the beginning.
My question is: how do I make a new dialog appear on top of my main dialog so that after each calculation a string is sent to a message box telling which calculation I am on, i.e. the text box says “Working on calculation 1” and then “Working on calculation 2” and so forth.
I know how to make a new dialog appear using the CNewDialog dlg; and dlg.DoModal(); commands, and I also know how to write a single string to the text box using dlg.m_CalcNumber = "Working on calculation 1"; command. I have no idea how to overwrite this string over and over again. Please help!!!!!!!! Much thanks in advance!
~Loren
|
|
|
|
|
You need a modeless dialog, not a modal one.
Instead of calling DoModal, you need to call Create then ShowWindow.
Use the handle of the dialog and send a message whenever you need to update the text.
|
|
|
|
|
1. You need to make your 2nd dialog modeless, call Create instead of DoModal.
2. You can then perform your calculations and update the modeless dialog after each calculation.
3. You call DestroyWindow to remove the modeless dialog when complete.
You need a message pump to make your modeless dialog redraw. The could be after each calculation or embedded within to get more frequent updates.
You could add a cancel button to your modeless dialog and store a value in a bool when it is clicked. You then check the bool in the calculation to see if you want to quit.
Hope this fragment helps:
C2ndDialog dlg;
dlg.Create(IDD_2ND, this);
dlg.ShowWindow(SW_SHOW);
AfxGetMainWnd()->EnableWindow(FALSE);
{
//do calculation
//update value in dlg
MSG msg;
while ( ::PeekMessage( &msg, NULL, NULL, NULL, PM_NOREMOVE ) )
{
//message pump to redraw dlg
AfxGetApp()->PumpMessage();
}
}
while (calculating);
AfxGetMainWnd()->EnableWindow(TRUE);
workDlg.DestroyWindow();
j a m s p o o n
|
|
|
|
|
Hey Gang,
I am working on creating a custom GUI using C++ (primarily for game programming). For the most part, the GUI will mimic the structure and functionality of the Java Swing GUI 1.1.
The Swing GUI has a 'Component' class with a child 'Container' class that inherits from Component. (A Container is basically a Component that can contain multiple Components.)
The problem I am having using C++ is that the Component Class needs a function 'DeleteFromParent' that retrieves a Container object and calls one of the Container member functions.
Using a forward declaration I can retrieve a Container object in a Component function, but I still can't call any of the Container functions because the class has not yet been defined.
Any suggestions?
Thanks
Todd
|
|
|
|
|
i m doing matlab c++ programming and I met some problems which I cannot solve.
to consider
[features, targets] = improved_DA1(x, [cluster,0.95]);
in matlab....
what should i do in order to call the [cluster,0.95] in Matlab C++ ?
i did try to use mwArray(cluster , 0.95) and i get the following compiling result:
matlabwizard\matlabfunction.cpp(102) : error C2665: 'mwArray::mwArray' : none of the 21 overloads can convert parameter 1 from type 'class mwArray'
C:\foo\matlabwizard\matlabfunction.cpp(103) : error C2664: 'matlabmain' : cannot convert parameter 1 from 'class mwArray' to 'int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
can anyone help me?
thank you very much
Matlab C++ newbie
|
|
|
|
|
Could someone tell me the realtionships between OnPaint / OnSize / OnCreate / OnInitialUpdate / OnUpdate of a view and it what process?
It seem they all get used and I cannot figure out in what sequence.
Which method should do the initial data processing - OnPaint ? MFC wizard notes " Do not use in view" , but it adds GetDocument code in OnPaint - why?
My application has several views ( graphics and data tables) of a document which initially has no data in it. I need to build all these views and than fill them up with data at random intervals. I have managed to build initial tiled views, but I am having trouble updating (UpdateAllViews) and resizing individual views. I have also noted that some of the methods are used more than once in a process - especially OnPaint. My basic test MFC MDI application seems to go thru several different sequences each time I start it.Thanks for your help. Vaclav
|
|
|
|
|
Vaclav wrote:
It seem they all get used and I cannot figure out in what sequence.
You might want to set a breakpoint at the beginning of each one to see the order in which each is called. Be careful with OnPaint() , however, as it's called a bunch!
Vaclav wrote:
Which method should do the initial data processing
How about OnInitialUpdate() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
How can you draw a bitmap outside of OnPaint() function?
calling "CPaintDC dc(this)" outside of OnPaint() compiles and executes, but doesnt work.
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
CDC* dc = GetDC();
dc->BitBlt(...);
ReleaseDC(dc);
--
Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et
insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur:
tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui
ad perditiónem animárum pervagántur in mundo, divína virtúte,
In inférnum detrude. Amen.
|
|
|
|
|
Jorgen's method is one way. Another is to use CClientDC(this)
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I'm trying to develop an process host like "svchost.exe". But i'm in trouble with method calling from a different process. As a result i want to call a function from another process and get its return value. Can i do that? What way should i follow to do that? By the way i can get process number which i created.
Second question is, how can i create "wait status" process? These processes should be in wait status until i call a function from this process?
Thank you...
Orkun GEDiK
ASTRON
|
|
|
|
|
|
Ok. But i can't use WaitForSingleObject() because processes should be in "wait status". I don't want to wait end of process. If i use WaitForSingleObject(), i should wait end of process. But process shouldn't be stop. Process should be wait for a signal from another process without termination.
Regards...
Orkun GEDiK
ASTRON
|
|
|
|
|
For C++ code I am writing for a COM server I need a functionality where I have a fileName as Input and need to know if the File exists !
Preferably non MFC code is desired !
would a call like
string fileName
.
.
FILE *fPtr;
fPtr=fopen(fileName.c_str(), "r");
can i test fPtr and judge if the file is present or not ! Is it safe to do that ?
|
|
|
|
|
A pure Win32 API solution:
<code>
bool DoesFileExist(LPCTSTR pFileName)
{
WIN32_FIND_DATA findData;
HANDLE hFind = FindFirstFile(pFileName, &findData);
if (hFind == INVALID_HANDLE_VALUE)
return false;
FindClose(hFind);
return true;
}</code>
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Here are at least two ways:
_access();
_stat();
GetFileAttributes();
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi All!
Trying to get the image of a window using Hbitmap,DC,Memory DC and BitBlt.
This works fine, but since the function BitBlt copies from the screen, I am having tough time gettin the image of a hidden or partially shadowed window.
So is it possible to get the image of a window(even if its partially hidden) if we know its DC? I would also like to get more information on how does windows actually renders a DC. Can we force the rendering to a memory DC or memory buffer (instead to the screen) from where the image can be copied?
Thanks!
-Vladimir India
|
|
|
|