|
So, could anybody tell me what should I do with the call stack to see what's going on ????
|
|
|
|
|
I have a question about the function "thisfunctiondoesntwork()"
line:
this->GetTreeCtrl().GetItem(&tvitem);
What is the tvitem? Moreover, what do you mean "this"
I think windows get confused when you refer to "this"
Vu
vucsuf
|
|
|
|
|
Hi all
I need to start a program from a cluster resource dll in such a way that it behaves as if it was started by a logged in user.
Does anyone know what flags, settings, etc I need to use in CreateProcess/CreateProcessAsUser to do this?
I am sure this must be possible, as the Generic Cluster Resource Type seems to do something similar?
Thanks
Martin
|
|
|
|
|
In my application, i have a member variable double *m_pTab.
firstly, i have created a function which take 1 parameter(parameter1) which be used to allocate memory as follow: m_pDate=new double[parameter1], and after, in the same function, i modify the value of the pointer. For example, *(m_pTab+i)=value_i;
Now, i would like to use this member pointer in another function with the affectation done above, it's my pb, because i don't know how looks like the syntax of this kind of operation.
So, is anybody could explain me how to solve my problem?
thanks in advance
gerald
|
|
|
|
|
I'm not sure to understand, but I suppose m_pTab is the same as m_pDate.
So the line *(m_pTab+i)=value_i; is equivalent to m_pDate[i]=value_i; .
Then, what you want to do in the other function?
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi,
Q1:
I have a flat owner draw button that seems to work ok with an icon attached to it. Now the thing is that I want to change the background color of the window which the button is attached to, and I want the color to shine through the button, sort of having a transparent button. How can I do this?
Q2:
If I make an Icon in the VC++ editor, can't I use some sort of transparency background color? (To solve the question aforementioned)
|
|
|
|
|
If I make an Icon in the VC++ editor, can't I use some sort of transparency background color?
Yes, Windows icons can have 'transparent' pixels. In VC++ Icon Editor, use one of the silly-looking tools in the color palette. It's rather hard to describe, looks more or less like little green monitor located in the upper row of icons, on the left side of black rectangle.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Yes, I've tried using that "color". But my window background, to which my button is attached to, does not "shine" through the button. I get a greyish look of the button even if I have a blue background window.
Maybe the CButton class defaults to a color...?
/T
|
|
|
|
|
On Win2000 you can use UpdateLayeredWindow to create translucent windows. With earlier versions your only solution is to copy background bits to DIB section and compose the foreground bits using some blending function, then copy DIB section to screen as button image.
If all you need is completely blue button with icon, handle WM_CTLCOLORBTN.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hello,
I want to resize the Window Standard Dialog (File open Dialog) on the button click as i want to add some extra control on the hidden area and then on button click i want to show all these controls. I
I have done this and it is running on Win NT but this application is not running on Win2K. When i tried to resize the list control moves and all the controls move downward but not giving room to other hidden controls.........
Can any one suggest what to do......
|
|
|
|
|
Hi,
On Win2K and WinME the common file dialogs are resizable, so I guess you want to disable this feature.
Search for OFN_ENABLESIZING on MSDN for further details.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi there,In WinCE Programming ,I cant use CFindFile class,So,how I can enumerate all the .txt files in some directory?
Thanks a lot.
|
|
|
|
|
FindFirstFile(...) --requires CE 1.0 or higher
_findfirst(...)
|
|
|
|
|
Dear all,
I am writing a programme using VC++ to display html or other kind of web page as help files. To make it more advance, I need to check the existency of the given URL before display it out so that it will browse to an user-default "unavailable page" instead of the usual 404-error page.
I am now facing a problem to verify the URL. I have tried several ways and none seems to work.
1. using InternetOpen follow by InternetOpenURL to check if it return a valid handle.
2. trying to use OnDownloadComplete through DISP_FUNCTION_MAP in CView ( as my IWebBrowser2 is not in CHtmlView, I cannot use DWebBrowserEvent )
for case (1),
InternetOpenURL other return NULL with error code 997 for all kind ( exist or non-exist ) of URL if InternetOpen using INTERNET_FLAG_ASYNC for the dwFlag.. think there is a bug in MFC as told in Microsoft KB(Q176176)
or, InternetOpenURL other return a valid handle for all kind ( again exist or non-exist ) of URL if InternetOpen using 0 for the dwFlag.. obviously this is wrong as I would like to receive NULL for non-exist URL.
for case (2),
I got problem when I try to call AfxConnectionAdvise(), it fail when it step into pCPC->FindConnectionPoint(iid, &pCP) in CTLCONN.cpp line 166 and return handle 0x80004002 ( which I found out as CdoE_INTERFACE_NOT_SUPPORTED, but I am not 100% sure )..
have anyone faced this kind of problem before. hope you could help
Thanks in advance.
Regards,
Kathy
|
|
|
|
|
Have you tried?
try {
...
pIH = InternetOpenURL(...);
...
}
catch (InternetException* pEx) {
::MessageBox(...);
// Handle your exception
}
|
|
|
|
|
I have a edit control (I am using c/sdk) which i tend to make it as text area to display my program message. the control has properties as:
vertical scroll, auto vscroll, want return.
I was wondering how can i add text in multiple line. for instance, i use
char *buf1 = "hello\r\n";
char *buf2 = "hai\r\n";
SendMessage(GetDlgItem(hDlg, IDC_CON_CON), WM_SETTEXT, 0, (LPARAM) buf1);
SendMessage(GetDlgItem(hDlg, IDC_CON_CON), WM_SETTEXT, 0, (LPARAM) buf2);
it can only display
hai
where i want
hello
hai
Pls help. If possible, do e-mail the solution to my mail box
yccheok@yahoo.com
since i don't have any internet access in this few day and it may take my sometimes to search back my message
thanks
regards
yccheok
|
|
|
|
|
Each SendMessage replaces the text in the control with the text in the LPARAM parameter. Try this instead:
char *buf = "hello\r\nhai\r\n";
SendMessage(GetDlgItem(hDlg, IDC_CON_CON), WM_SETTEXT, 0, (LPARAM)buf);
You'll get this reply mailed automatically from the CP server.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I face some problem in implementing a multithreading dialog based program (C/SDK) which used to simulate dining philosopher problem.
In my program, I create 6 threads using _beginthread() respectively where
the 5 threads is use to keep looping in an infinity loop, update their state and keep sending InvalidateRect() to a display control. It roughly look like this :
void Run( void *pParam)
{
while(ps->bRunnable)
{
Update Philosopher State
InvalidateRect(hwndCtl, NULL, TRUE);
UpdateWindow(hwndCtl); // hwndCtl is handle to subclassing
// control which has his own message
// procedure
}
}
one thread is responsible to keep track one the timing. When the time reach, it will stop the other 5 threads. It roughly look like this :
void RunSimulation(void *pParam)
{
start philosopher thread
while(time(0)-tTimeStart < nSimulation[nIndexSimulation] &&
bSimRunnable)
{
}
bSimRunnable = FALSE;
}
I start both threads with :
_beginthread(Run, 0, (void *)ps)
_beginthread(RunSimulation, 0, (void *)ps)
However, I totally lose my control on the GUI control. My mouse click on
the dialog box would not responde until all the threads finished. I try to clear the message in the queqe before philosopher thread further sending any
message. I place the following code inside Run()
void Run( void *pParam)
{
// clear the message queqe before thread further send any message
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{ ///////////////////////////////////////////////
//BUT THE THREAD NEVER ENTER THIS BLOCK! WHY???
///////////////////////////////////////////////
// seperate dialog box message from null parent window
if( !IsDialogMessage(hDlgMain, &msg) &&
!IsDialogMessage(hDlgCon, &msg) &&
!IsDialogMessage(hDlgGraph, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg); // send to null parent
}
}
while(ps->bRunnable)
{
Update Philosopher State
InvalidateRect(hwndCtl, NULL, TRUE);
UpdateWindow(hwndCtl); // hwndCtl is handle to subclassing
// control which has his own message
// procedure
}
}
----------------------------------------------------------------------------
This won't work and the dialog box still hang up
while the threads is running.
Pls help. If possible, do e-mail the solution to my mail box
yccheok@yahoo.com
since i don't have any internet access in this few day and it may take my sometimes to search back my message
thanks
regards
yccheok
|
|
|
|
|
1) There's no sense in calling PeekMessage or other message-oriented functions in Run. This thread is a 'worker' one, doesn't have message queue. Remember that message queues are created and accessed per-thread. PeekMessage inside Run is guaranted to return FALSE.
2) The main problem with application being not responsive to mouse movements etc. can be related to the frequency of calls to Invalidate/UpdateWindow being made inside Run. If updating philosopher state doesn't take much time, you're sending lots of WM_PAINT messages to hwndCtl. UpdateWindow removes these messages and repaints the control, however, message queue is stressed by 5 threads. Note that calling InvalidateWindow in worker thread posts message in the message queue of main (UI) thread.
You should invalidate the control periodically, not in every pass of the loop. Use GetTickCount to compute time elapsed from last repaint and redraw every second (for example, you may choose different interval). This will reduce flicker and should make your app responsive to user actions.
If possible, do e-mail the solution to my mail box
CodeProject server sends email to you automatically, unless you explicitly de-select this option when posting.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi just wanna ask how do you manipulate the "Z-order" in visual C++??? How do you put one picture box on top or at the back of another picture box...
Thanks......
|
|
|
|
|
SetWindowPos is generally how you set the Z-order of a window. Given that controls are also a CWnd, I'd try that first.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
hi..
m_s1 and m_s2 are CSTATIC but seems like it's not working...
void CTesting3_bmpView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CFormView::OnLButtonDown(nFlags, point);
if (flip == TRUE)
{
flip = FALSE;
m_s1.SetWindowPos (&wndTop, 1, 1, 100, 100, SWP_NOSIZE | SWP_NOMOVE);
//m_s1.BringWindowToTop ();
}
else
{
m_s2.SetWindowPos (&wndTop, 1, 1, 100, 100, SWP_NOSIZE | SWP_NOMOVE);
//m_s1.BringWindowToTop ();
flip = TRUE;
}
UpdateData(FALSE);
Invalidate();
}
|
|
|
|
|
are you trying to show between two button at the same position to do two different task ?
if so, i sugguest you not to use z-order but just change the object text of the button ( or CStatic ) by CWnd::SetWindowText(LPCTSTR lpszString) and if they are executable, set a flag ( i think you already have, which is "flip".. ) and in OnClick of that object, check the flag and do different task.. but as you said they are just static.. i guess you only wanna display different text SetWindowText can do what you need
|
|
|
|
|
I have an ATL COM DLL for a project I'm working on. It has a progress bar so some of our other COM objects can load and use it for showing progress...
At any rate, the Dialog is based on CAxDialogImpl. This dialog HAS a Cancel button so I don't want to override OnCancel. I tried overriding WM_KEYDOWN which works fine for any OTHER key pressed but for some reason doesn't capture the Escape key.
Anyone have any other ideas? Please help.
Matt Philmon
|
|
|
|
|
GetAsynchKeyState(VK_ESKAPE);
(in your OnCancel(...) to check the state)
|
|
|
|
|