|
There are 3 tabs in my application. On opening the application the 3rd tab will be in focus. When i try to resize the tabwindow, 3rd will be in focus but the contents of 2nd tab will be displayed. After switching between the tabs the tabs will get refreshed. How do I solve this refresh problem?
|
|
|
|
|
How are you setting the default tab to the third tab at startup?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
TCM_SETCURSEL does NOT cause a TCN_SELCHANGE message to be sent, so when you use
SetCurSel(), you are responsible for making sure the correct tab window is
positioned and shown within the tab's "client area".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So, how do I solve this refresh problem now?
|
|
|
|
|
A couple of weeks ago I enabled XP's automatic updates (it hadn't been upgraded since I installed XP SP1 a year ago). After the upgrade (XP SP2 and it also did some secuirty upgrade to my VS2005) I cannot build any of my code anymore. At first I got a bunch of errors, then I retarted my machine, at which point there was an error message on boot up that I've never seen before, immediately followed by an "automated" fix. Now when I try to recompile again it still doesn't work, but the errors are different.
------ Rebuild All started: Project: NSMAnalysis, Configuration: Release Win32 ------
Deleting intermediate and output files for project 'NSMAnalysis', configuration 'Release|Win32'
Compiling...
stdafx.cpp
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(2613) : error C2061: syntax error : identifier 'HDROP'
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin.h(3621) : error C2061: syntax error : identifier 'HDROP'
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin2.inl(70) : error C2039: 'DragAcceptFiles' : is not a member of '`global namespace''
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin2.inl(70) : error C2660: 'CWnd::DragAcceptFiles' : function does not take 2 arguments
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin2.inl(423) : error C2065: 'HDROP' : undeclared identifier
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxwin2.inl(424) : error C2448: 'CWnd::OnDropFiles' : function-style initializer appears to be a function definition
I can't find where HDROP is defined but the error concerning DragAcceptFiles is strange. afxwin2.inl calls this function with 2 arguments but it's defined in afxwin.h with only one. How is this possible? Were the header files changed during the updates?? If they weren't how did it EVER work?
Thanks.
Mike
|
|
|
|
|
|
May be You have to reinstall VS2005 again.
|
|
|
|
|
How do I delete the pop up menu created by default in the CEdit class?
|
|
|
|
|
Sunayna wrote: the pop up menu created by default in the CEdit class?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Have you searched CP for "CEdit context menu"?
|
|
|
|
|
Sunayna wrote: How do I delete the pop up menu created by default in the CEdit class?
you have to derive the class from the CEdit and handle the WM_LBUTTONDOWN message and plant your new popup menu there!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
ThatsAlok andle the WM_LBUTTONDOWN message
Is it right??
Regards,
Sandip.
|
|
|
|
|
There is a MDIchild window which has the CEdit class. Initially page up and page down keys were working.On setting the virtual key codes for page up and page down, page up and page down is not working. How do I enable the functionality of Page up and page down
|
|
|
|
|
What is bad in handling the OnKeyDown/OnKeyUp and calling the scroll if pressed key is PageUp/Down??
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
There are two tabs in my application. One is the parent and the other is the child. The parent tab is CView and the child tab is the CEdit control. Page up and page down are working for the parent but not for the child. I tried to implement ur suggestion but still page up and page down isn't working for the child.
Thanks
|
|
|
|
|
Ok, in that case it is not going to work. I had the same problem and an easy solution I found (is not the best, I know it) was to declare Hot Keys with the VK_ that I wanted to check in other views. The Hot Keys are global in the app, but locally executed. For me worked. Take a look on that.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi guys,
I am trying to implement some command-line arguments for my application. I would like to be able to run the program with "Program.exe -w800 -h600" to force the resolution to be displayed at 800*600.
I've come up with this basic code that I would have thought could achieve the goal I had in mind but I get the error
error C2446: '==' : no conversion from 'const char *' to 'int' There is no context in which this conversion is possible
So lpCmdLine is a pointer to a const char , so how do I extract the information I want from it? Wouldn't it have been easier for microsoft to just implement it as an array of char 's?
WINDOW_WIDTH and WINDOW_HEIGHT are both global integers.
for (int n=0; n < (sizeof(lpCmdLine) / sizeof(char)); n++)
{
if(lpCmdLine[n] == "-" && lpCmdLine[n+1] == "w")
{
char w[4];
w[0] = lpCmdLine[n+2];
w[1] = lpCmdLine[n+3];
w[2] = lpCmdLine[n+4];
w[3] = lpCmdLine[n+5];
WINDOW_WIDTH = w[];
}
if(lpCmdLine[n] == "-" && lpCmdLine[n+1] == "h")
{
char h[4];
h[0] = lpCmdLine[n+2];
h[1] = lpCmdLine[n+3];
h[2] = lpCmdLine[n+4];
h[3] = lpCmdLine[n+5];
WINDOW_HEIGHT = h[];
}
}
The solution probably has something to do with some hefty use of pointers
|
|
|
|
|
You should use atoi[^] if you want to convert a string (e.g. "800") into the corresponding integer.
|
|
|
|
|
sorry but I don't think that will work for my purposes
I need to be able to parse the string first for any - signs followed by either a w or h. Once I get that working then I would be able to use atoi to convert the numbers in the string but I can't get to that point using atoi
|
|
|
|
|
Your code has several flaws.
Try
int iLen = _tcslen(lpCmdLine);
for (int i = 0; i < iLen - 2; i++)
{
if ( lpCmdLine[i] == _T('-'))
{
if (lpCmdLine[i+1] == _T('h'))
{
WINDOW_HEIGHT = _tstoi(&(lpCmdLine[i+2]));
}
else if (lpCmdLine[i+1] == _T('w'))
{
WINDOW_WIDTH = _tstoi(&(lpCmdLine[i+2]));
}
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It took me a few minutes to understand your code (had to search through all the help files for all that stuff I've never seen before)
It looks like it should work.
But it doesnt
error C2664: 'wcslen' : cannot convert parameter 1 from 'LPSTR' to 'const wchar_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2664: '_wtoi' : cannot convert parameter 1 from 'CHAR *' to 'const wchar_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
error C2664: '_wtoi' : cannot convert parameter 1 from 'CHAR *' to 'const wchar_t *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
And could you please give me some hints as to why my code is flawed? I was already aware there was something wrong with it, hence the reason it doesn't work.
|
|
|
|
|
OK. These errors arise because the LPSTR nature of lpCmdLine . Use:
int iLen = strlen(lpCmdLine);
for (int i = 0; i < iLen - 2; i++)
{
if ( lpCmdLine[i] == '-')
{
if (lpCmdLine[i+1] == 'h')
{
WINDOW_HEIGHT = atoi(&(lpCmdLine[i+2]));
}
else if (lpCmdLine[i+1] =='w')
{
WINDOW_WIDTH = atoi(&(lpCmdLine[i+2]));
}
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thankyou, your code works flawlessly.
Bloody legend :P
Now, may we discuss the bad things I did in my original snippet so that I may learn from it in the future? That would be nice
|
|
|
|