|
Cheers for the response. OK, I see where your going with this, but I`m still unsure as to how to link it to the edit box? I`m using a dialog box to house this control. I have so far placed the edit box and the CSpinButtonCtrl on the dialog. I have created variables for both in the dialog framework (for the CSpin a DDX control is used). Do I still have to "create" the CSpin thingy? or do I link it some other way?
Many Thanks,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Chambers wrote:
or do I link it some other way?
Yes. Ensure that the ids of the controls are consecutive (spin control > edit control), then set the "AutoBuddy" property of the spin control in the resource editor.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
What do I set the "Auto Buddy" too? the ID value of the edit box I presume? If this is right don`t worry about answering it, I`ll delete it if it works now.
Thanks again,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
What I meant was check the "AutoBuddy" property of the spin control in the resource editor. If your ids are consecutive, the spin control will automatically become the buddy of the previous edit control, which causes them to be linked.
Also, you can position an autobuddy spin control anywhere in the dialog - it will be automagically rendered inside the edit control. So remember to account for the extra space when sizing the edit control.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Right, I`ve managed to get them linked, finally. I had to enter the resource editor and swap the order of the ids around because it kept attaching to the save button i had (which is exactly what you said to do Ravi). However, the numbers go UP when i press the DOWN button, and visa versa. How do I swap them around, so that the up button makes the integer go UP, not blinking down?
Cheers for your help getting me this far Ravi,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Yes, that's annoying!
I suppose you could override the spin control's notifications and manually set the edit control to do the opposite.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I found an easier way. MSDN help says that, by default, the CSpin thingy's range is set to Min:100 Max , and by clicking the down arrow sends the current value nearer the minimum value, which is why it goes up, its heading for 100. All I did to get it to work properly was call :
CDialog::DoDataExchange(etc.)
{
... min , max
myCSpinThingy.SetRange(0 , 10);
}
and it worked no problem. Just thought I`d let you know, since I wouldn`t have got there in the end if it weren't for you,
Cheers Ravi,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Is there any component to canvert .txt(richeditview)
to htmlview???Or how can I do that?
|
|
|
|
|
I need IIS ,and I search microsoft web site,but I could not find the setup file of it.Does anybody know where can I find it?
|
|
|
|
|
You can go to www.microsoft.com and search for Nt Option Pack.. here is the link but it maybe too long.
http://search.microsoft.com/default.asp?boolean=ALL&nq=NEW&so=RECCNT&ig=01&ig=02&ig=03&ig=04&ig=05&ig=06&ig=07&ig=08&ig=09&ig=10&i=00&i=01&i=02&i=03&i=04&i=05&i=06&i=07&i=08&i=09&qu=nt%20option%20pack&siteid=us
Rob
|
|
|
|
|
Hi all,
im having real trouble trying to use internet explorer automation. I simply want to use the automation to navigate to a page and then print it but i cant even get the object into my project.
What i have tried to do is by using classwizard to add the IWebBrowser2 interface from the shdocvw.dll. However, simply doing this means that my project no longer compiles and gives me the following error:
shdocvw.h(5) : error C2011: 'IWebBrowser2' : 'struct' type redefinition
which then spawns off loads of other errors.
Can someone please tell me what im doing wrong. This is a very simple task that loads of programmers must have done.
Please reply, all replies will be rated favourably as msdn is so full of shite its hard finding the right answers.
Andy.
|
|
|
|
|
Hey
just want to know what is the easiest way to obtain a bitmap( in fact a handle of a bitmap) from a device context of the client zone of a window in which i have already drawn something
Thx for answer
Bye
|
|
|
|
|
get a dc
create a compatible dc (memory dc)
create a compatible bitmap (memory bmp)
select the memory bmp to the memory dc
bitblt from the screen dc to the memory dc
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Hi,
i have this piece of code
>>>>>>>>>>>>>>>>>>>>>>
struct CAddInfo
{
CAddInfo(){}
CAddInfo(const CString& szName, DWORD iSize, bool bDir = false)
:m_szName(szName), m_iSize(iSize), m_bDir(bDir){}
CString m_szName;
bool m_bDir;
DWORD m_iSize;
};
typedef CList<caddinfo, caddinfo=""> CAddInfoList;
CAddInfoList list;
void CJRZipArchive::AddFolder(CString szFolder)
{
try
{
szFolder.TrimRight(_T("\\"));
CFileFind ff;
BOOL b = ff.FindFile(szFolder + _T("\\*"));
CStringArray folders;
while (b)
{
b = ff.FindNextFile();
if (ff.IsDots())
continue;
if (ff.IsDirectory())
{
folders.Add(ff.GetFilePath());
}
else
{
CAddInfo ai;
ai.m_szName = ff.GetFilePath();
CFileStatus fs;
if (CFile::GetStatus(ai.m_szName, fs))
{
ai.m_bDir = false;
ai.m_iSize = fs.m_size;
list.AddTail(ai);
m_iTotal += fs.m_size;
}
}
}
for (int i = 0; i < folders.GetSize(); i++)
{
list.AddTail(CAddInfo(folders[i], 0, true));
// add the folder before adding its files
// it is not needed to add the root folder
AddFolder(folders[i]);
}
}
catch (CException* e)
{
e->ReportError();
e->Delete();
}
catch(...) // thrown in the STL version
{
AfxMessageBox("Error");
}
}
<<<<<<<<<<<<<<<<<<<<<<<
Sometimes, this causes an ASSERT in the line 40 of timecore.cpp (the last ASSERT of a CTime constructor)...
Does anyone know if there is any situation of a file the should cause it?
Thank u very much,
Dirso.
|
|
|
|
|
Hi All,
I'm having some trouble debugging the following function under Windows 2000 w/ Visual Studio 6.0. Where the function calls the socket API function, the debugger is reporting the following:
HEAP[Sockets.exe]: Heap block at 00140390 modified at 0014070E past requested size of 376
HEAP[Sockets.exe]: Invalid Address specified to RtlReAllocateHeap( 130000, 140398 )
Does anyone see something that I am missing? This function appears to work correctly when executed outside of the debugger (the socket gets bound and can accept connections from other machines), but . . .
Here is the code I am testing:
// Creates a socket in the local machine
SOCKET CreateLocalSocket(int port)
{
SOCKET s = INVALID_SOCKET;
char localHost[256];
hostent* pHostEntry = NULL;
sockaddr_in sa;
// Get the name of this machine
printf("\ngetting local host name . . .");
if(0 != gethostname(localHost, 256))
{
printf("failed.");
return s;
}
else
printf("succeeded.");
printf("\nlocal host name = <%s>", localHost);
// Deprecated function call
printf("\ngetting local host address info . . .");
pHostEntry = gethostbyname(localHost);
if(pHostEntry == NULL)
{
printf("failed.");
return s;
}
else
printf("succeeded.");
// Create a socket
printf("\ncreating socket . . .");
s = socket(AF_INET, SOCK_STREAM, 0);
if(s == INVALID_SOCKET)
{
printf("failed.");
return s;
}
else
printf("succeeded.");
// Set up the socket address struct
memset(&sa, 0, sizeof(sa));
sa.sin_family = pHostEntry->h_addrtype;
sa.sin_port = htons(port);
printf("\nbinding socket . . .");
if(0 != bind(s, (sockaddr*)&sa, sizeof(sa)))
{
printf("failed.");
return s;
}
else
printf("succeeded.");
return s;
}
Thanks in advance for any help.
|
|
|
|
|
Hi to all,I facing some problems when i executed a source code in Visual C++ under MFC environment.Hope someone can help me to solve it.
Well actaully this file is running fine if i compile it under Visual C++ Win32 console application.
But once i put it into Visual C++ MFC environment,it didn't show any error,but it just not fuctioning.
char c;
ofstream modem("COM1:");
printf("Resetting MODEM\n to Dial");
modem << "ATZ\n";
modem.flush();
c = getchar(); // wait for modem to finish
modem <<"ATDT0123246448\n";
modem.flush();
printf(" to Hang-UP\n");
c = getchar(); // wait for modem to finish
modem <<"ATH0\n";
modem.flush();
Hope guru's can help me on this.
Thank you.
|
|
|
|
|
Try using OpenFile() instead. I've used it to talk to a printer on an LPT: port.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi guys, I actually have three unrelated questions that I would like answered, they are :
1.) Can you have ranges in a switch statment, i.e.
switch (i)
{
case 0..20 : do something;
case 20..120 : do something;
case 170..450 : do something;
}
Obviously the dotted line doesn`t work, but what do I have to do to get such a switch statement to work?
2.) Is there any way of getting the maximized state of a child window, without using one of the OnDoSomething() functions, i.e. is there a function in MFC which will tell me, true or false, the current child window is maximized?
3.) How can I create one control that holds separate integers in the format :
1 | 2 | 3
3 | 2 | 1
2 | 1 | 3
oh I also would like to know how to make it change size, say to hold five integers accross, and maybe three down.
Thanks for reading this far guys, if you know the answer to any of the three questions, or merely have an idea, please let me know, I would be very grateful.
Thanking you all,
Alan.;)
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
2. Look up CWnd::IsZoomed in MSDN
Michael
|
|
|
|
|
Michael your answer to question was Perfect! What a weird name to call it though? I was looking through the MSDN help for IsMaximized etc etc.., ah well you live and learn,
Thanks for the response Michael,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
1) Nope, you can't do ranges, unfortunately. You need to use an "if" statement.
2) IsZoomed, as answered by Michael.
3) I don't know. You want to create a custom data entry control? Why not use several edit controls placed next to each other?
Regards,
Alvaro
|
|
|
|
|
1.)
switch (i)
{
case 0:
case 1:
case 2:
...
case 20:
break;
case 21:
case 22:
...
case 450:
break;
}
Though you should just use an if statement.
if ()
else if ()
else
3.) Try Chris Maunder's Grid Control.
Jon Sagara
"Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
|
|
|
|
|
Thanks for the responses guys, especially for the Grid control link (Jon) cos its pretty much what I need (i need a simplified version, but I`ll just cut it down to that). I didn`t think you could have the ranges in a switch statement (since there are no books that describe how to) so thanks to both Alvaro and Jon for reaffirming my doubts. Oh and thanks to Chris Mauder for actually producing the Grid Control and making it freely available.
Cheers guys,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
- Yes, if you use Pascal instead of C/C++ . (Silly answer).
- You can also use GetWindowPlacement() for the general case, but IsZoomed() as pointed out earlier, is definitely easier.
- In general, you need to override the control's WM_PAINT handler to "do the right thing", i.e. display the numbers in an appropriate format. You can use Chris' grid control, but if you want your class to be lightweight, you'll probably want to just override OnPaint().
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
In response to your answers :
1. Yep, thats why I asked if you could do it in C++.
2. Its definately the easiest function, and the most appropriate for what I want.
3. I am seriously thinking of doing your OnPaint overriding advice, cos I've had a look at Chris's non-MFC code, and I must be honest, I`m struggling to understand it.
Thanks for your response though,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|