|
Thanks for your great help..but I don't know it is giving me errors like:
left of '.GetText' must have class/struct/union type
Thanks again
C++Prog
|
|
|
|
|
Preeti9 wrote: left of '.GetText' must have class/struct/union type
Which is telling you that m_ListBox1 must be a CListBox object.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
I've recently converted my VS6 project to 2005 and the problem I'm now getting is that my open/save dialogs aren't opening at all. ie) I have a file import dialog that was working, but is now not being displayed at all. My class is derived from CFileDialog. The section of code this seems to be failing in is:
in dlgfile.cpp
CFileDialog::DoModal()
{
...
INT_PTR nResult;
if (m_bOpenFileDialog) (true)
nResult = ::AfxCtxGetOpenFileName(&m_ofn);
...
}
from this nResult is 0. from there is returns a IDCANCEL due to nResult being 0.
I can step into this call, where it goes to:
OPENFILENAME& CFileDialog::GetOFN()
{
return *m_pOFN;
}
m_pOFN seems to be a valid structure, although most of the data seems to be defaults with some empty pointers.
Anyone have any thoughts on what might cause this to return false/0?
I can't seem to find any documentation on AfxCtxGetOpenFileName ().
Thanks for your help.
|
|
|
|
|
Hi,
How can i distinguish between Excecute Key and + Key while both having the same pMsg->wParam = 0x0000002b.
Any body having an idea pls tel me.
yours faithfully
ajeesh c v
|
|
|
|
|
Ajeesh c v wrote: How can i distinguish between Excecute Key...
What's this?
Ajeesh c v wrote: ...and + Key
Is this the VK_ADD key?
"The largest fire starts but with the smallest spark." - David Crow
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Ajeesh c v wrote: How can i distinguish between Excecute Key and + Key while both having the same pMsg->wParam = 0x0000002b.
Any body having an idea pls tel me.
What is Execute Key, have you check the value of lParam!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Help CRY
|
|
|
|
|
I am making a custom control that can recieve some datas and verify the datas recieved.
The custom control(suppose it is named CDataVerify) is inherited from Cwnd and it contains three CEdit controls.The design is when the focus leaves the CDataVerify, it(CDataVerify) should verify the values of thethree CEdit control.
Now the problem comes, when the focus leaves the CDataVerify control,how can the CDataVerify control know the focus lose and should verify the datas?
(At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus. When typing something to the contained CEdit control, the focus just belongs to the CEdit control, not the CDataVerify.)
Is there any way to let the CDataVerify control verify datas when the focus leaves?
//////////////////////////////
-- modified at 21:27 Thursday 25th May, 2006
|
|
|
|
|
willbin wrote: (At first I think the onKillFocus() event maybe resolve the problem. But it can not, for the CDataVerify control never got the focus.
But did the edit controls themselves receive the WM_KILLFOCUS message?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Thank you.
of course, yes. The edit controls recieve the WM_KILLFOCUS message. But the edit control recieved the WM_KILLFOCUS message only can deal with the data itself held. It do not know the value of its siblings. The Parent knows, but the parent has't the focus(Can not recieve the WM_KILLFOCUS message when the focus leaves.)
//////////////////////////////
A stranger , also a challenger
|
|
|
|
|
So can you handle WM_KILLFOCUS for the edit controls, and get them to send a message to their parent which triggers the data verification?
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"
|
|
|
|
|
Thank you.Notify the parent(CDataVerify) to do data verification in spite of wether or not the focus will be still setted to his parent.
Maybe not good enough, but it really resolves problem.
Thank Ryan.
//////////////////////////////
A stranger, also a challenger
|
|
|
|
|
willbin wrote: But the edit control...do not know the value of its siblings.
Nor should it. Each control should take care of itself.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi,
I'm learning how to insert a button into another application's window using c programming. In short, I wrote an EXE file which modified a particular Window of another EXE file to insert a button in that window. Need some advice:
a. I was able to get to the other application's window by first hooking onto the other application's window handle. But the strange thing is that my callback function for WM_LBUTTONDOWN of my introduced button was not called when I click on the inserted button. Instead, I had to do a GetMessage in my main program to get the message for the button and check the message member in there. With this, I was able to insert an extra button into a messagebox in another EXE file while it's running.
b. What I don't quite understand is that when I try to use the same technique on different windows, I get different errors. For instance, if I were to insert a button this way into a .NET window, the button shows up as a white patch. It responds to the click though. For some other programs, my button crashed without inserting itself. Puzzled by the different behaviour. Is it due to the windows message queue and the different nature of windows that I'm getting this?
c. Strangely, although my callback WinProc function is not called when I click on the button, not defining the WinProc actually causes my program to die when attaching itself to any window that's not a messagebox. Not quite sure why.
If someone can guide me to any article on how to insert controls into another app's windows or to understand the windows message loop more, I would be grateful. I'm trying to do a little enhancement to a program whose source code is lost (ie, I only have the binary).
My code looks like this:
#include
#include
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
int WinMain(HINSTANCE hInst,HINSTANCE,LPSTR,int)
{
HWND hWnd, hwndButton;
WNDCLASS wc;
MSG msg;
// Trace Windows Handle based on Name
hWnd = (HWND) 0x1D0458;
printf("Begin Program\n");
wc.style=CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc=WindowProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hInstance=hInst;
wc.hIcon=NULL;
wc.hremoved=NULL;
wc.hbrremoved(HBRUSH)COLOR_WINDOWFRAME;
wc.lpszMenuName=NULL;
wc.lpszClassName="BUTTON";
if (!RegisterClass(&wc)) return 0;
printf("Finished Creating Button");
hwndButton = CreateWindow(
"BUTTON", // predefined class
"H", // button text
WS_VISIBLE | WS_CHILD , // styles
// Size and position values are given explicitly, because
// the CW_USEDEFAULT constant gives zero values for buttons.
950, // starting x position
0, // starting y position
20, // button width
20, // button height
hWnd, // parent window
NULL, // No menu
(HINSTANCE) GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
NULL); // pointer not needed
if (!hwndButton) return 0;
ShowWindow(hwndButton,SW_SHOW);
UpdateWindow(hwndButton);
while (GetMessage(&msg,NULL,0,0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
printf("In Message Loop");
if (msg.message == WM_LBUTTONDOWN) {
MessageBox(0,"Button Worked in main loop","Button Worked",MB_OK);
printf("Works!");
ShowWindow(hwndButton,SW_SHOW);
} // end if
if (msg.message == WM_DESTROY) {
printf("Quitting\n");
// exit(0);
} // end if
} // end while
}// end all
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
return DefWindowProc(hwnd, msg, wparam, lparam);
}
|
|
|
|
|
How to create a vitual driver like VFD software ?
Thank you a lot .
imagic
|
|
|
|
|
I just can't see why the following code doesn't change the text color to red.
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc = ::GetDC(hwnd);
HPEN pen = ::CreatePen(PS_SOLID, 3, RGB(255, 0, 0));
HGDIOBJ old;
old = ::SelectObject(&hdc, pen);
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
case WM_LBUTTONDOWN:
::TextOut(hdc, 100, 100, TEXT("Hello Windows"), 13);
::SelectObject(hdc, old);
return 0;
}
ReleaseDC (hwnd, hdc) ;
return ::DefWindowProc (hwnd, message, wParam, lParam) ;
}
//////////////////////////////////////////////////////////////////////
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("HelloWin") ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("RegisterClass Fail!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
HWND hwnd ;
hwnd = CreateWindow (szAppName,
TEXT ("The Hello Program"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
MSG msg ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
|
|
|
|
|
for change color text you can use
SetTextColor(hdc,RGB(255,0,0));
whitesky
|
|
|
|
|
As WhiteSky implied, pens don't change the text colour. They change the colour when drawing lines, circles etc...
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 have following case,
I want to put some static text on toolbar.For that i am using SetButtonInfo function with some ID as a placeholder and setting width of button. using function,
m_wndToolBar.SetButtonInfo(10, ID_PLACEHOLDER1, TBBS_SEPARATOR, width);
and creating Control using ID_PLACEHOLDER1 as a paremeter.
In these case, the rectangle bouning the text is of some size say x. with a vertical seperator in the middle of text.
Now if i use
m_wndToolBar.SetButtonInfo(10, ID_PLACEHOLDER1, TBBS_BUTTON, width);
the width parameter has no effect and bounding rectangle is also of different size. but in these case there is no vertical seperator.
Can someone point me how i can remove the seperator and how to use SetButtonInfo function in a proper way.
Thanks in advance.
Regards
Abhi Lahare
|
|
|
|
|
error C2859...
how can I repair it&
|
|
|
|
|
|
Try turning off incremental builds and do a rebuild all.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Hmm. I think I must be overworking again...
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: Hmm. I think I must be overworking again...
I've worked for 1 company that required more than 40 (uncompensated) hours a week (usually ended up being 50-60). Since then, I only work 40+ if I'm being compensated for it in some fashion.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi All,
I am using directshow api to convert jpg files to video files.
when i try with more than three images it fails. How do i set media times. I am not including any transition effects here.
Thanks in Advance
Poornima
|
|
|
|
|