|
can somebody tell me how to get object or resource id of all the controls by passing dilaog handle progrmatically.
|
|
|
|
|
You can use EnumChildWindows , calling, inside your callback function, GetDlgCtrlID .
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.
|
|
|
|
|
thank you.
actually i need an handle of all the controls in a dialog.
can you please send me an example illustrating EnumChildWindows();
i m sorry for posting the message twice.
|
|
|
|
|
CPallini wrote: EnumChildWindows, calling, inside your callback function, GetDlgCtrlID.
What about simple call to GetNextDlgTabItem!
"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
Support CRY- Child Relief and you
|
|
|
|
|
ThatsAlok wrote: What about simple call to GetNextDlgTabItem!
Does not work unless the control has the WS_TABSTOP set (I know, usually a control HAS this style set).
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.
|
|
|
|
|
CPallini wrote: Does not work unless the control has the WS_TABSTOP set (I know, usually a control HAS this style set).
"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
Support CRY- Child Relief and you
|
|
|
|
|
Hello everyone
I want to learn how can I do this :
write a recursive function member level() for class template BST that determines the level in the BST at which a specified item is located .The root of the BST is at level 0 , its children are at level 1 , and so on
and this is the code for //--- Definition of search()
Code:
template <typename DataType>
bool BST<DataType>::search(const DataType & item) const
{
BST<DataType>::BinNodePointer locptr = myRoot;
bool found = false;
for (;;)
{
if (found || locptr == 0) break;
if (item < locptr->data) // descend left
locptr = locptr->left;
else if (locptr->data < item) // descend right
locptr = locptr->right;
else // item found
found = true;
}
return found;
}
Rooro
|
|
|
|
|
Hi all,
I am using CToolTipCtrl as follows:
m_ToolTip.AddTool(this,sToolTip,rc,1);
m_ToolTip.SetMaxTipWidth(MAX_PATH);
m_ToolTip.Activate(TRUE);
m_ToolTip.SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOOWNERZORDER);
MSG msg;
msg.hwnd = m_hWnd;
msg.message = WM_MOUSEMOVE;
msg.wParam = 0;
msg.lParam = MAKELONG(point.x , point.y);
msg.time = 0;
msg.pt.x = point.x;
msg.pt.y = point.y;
m_ToolTip.RelayEvent(&msg);
the tool tip is shown 100% ok, but when i log on to this site:
http://news.sky.com/skynews/home[^]
the tool tip stops from working. i think there is a control on that site that does something to my tool tip.
what am i doing wrong?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
How can I change font of dialog box programatically at runtime.
I tested OnSetFont() member function and SetFont method but failed.
Thanks
|
|
|
|
|
IMHO you have to propagate the WM_SETFONT message to dialog controls (that are dialog child windows). For instance, you can call (inside OnInitDialog )
EnumChildWindows(this->m_hWnd, MyFunc, (WPARAM)(HFONT)(*m_pFont));
where MyFunc is something like this:
BOOL CALLBACK MyFunc( HWND hwnd, LPARAM lParam )
{
HFONT hFont = (HFONT) lParam;
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont , MAKELPARAM(TRUE, 0) );
return TRUE;
}
and m_pFont is a pointer to a CFont object.
hope that helps.
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.
|
|
|
|
|
Thank you very much.
But it does not change size of the dialog!
I want that changes after setting a bigger font for example.
|
|
|
|
|
Hadi Dayvary wrote:
But it does not change size of the dialog!
I want that changes after setting a bigger font for example.
MoveWindow()
<div class='ForumSig'>"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 Support CRY- Child Relief and you </div>
|
|
|
|
|
I have a propertyPage in which I have CEdits. I want to display text entred in thoses CEdits from another CDialog.
for example in my Page I enter in the CEdit m_edit1 the CString "myName" I want that I transmit this value to an CEdit of a CDialog m_CEdit.setWindowText(m_edit1)
so they recommanded me to add message handlers to controls of this page.
what does it means ? and how I use these message in this CDialog in which I want to receive the data from this propertyPage ?
thank's
|
|
|
|
|
for example:
<br />
<br />
COleDateTime my_Time;<br />
<br />
int i = 600;
<br />
If use this method:
<br />
my_Time.Format(0000, 00, 00, 0, 10, 0);<br />
that ok, but if i = 12345, or 54321, the convert should very difficulty.
I hope obtain a easy method.
Thanks!
|
|
|
|
|
Look at the equal operators; they take __time64_t. Convert your value to __time64_t and then assign it. (Look of _time64 for how to use this.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
hanlei0000000009 wrote: int i = 600; // I want to convert i to COleDateTime (ten minute), how to convert?
if i always will be Time in Minute then what about passing this :-
CTimeSpan timeSpan(1000); //time in second
j=timeSpan.GetHours();
k=timeSpan.GetMinutes();
l=timeSpan.GetSeconds();
COleDateTime oleDatetime;
COleDateTimeSpan spanTwo;
spanTwo.SetDateTimeSpan(timeSpan.GetDays(),//int nDay,
timeSpan.GetHours(),
timeSpan.GetMinutes(),
timeSpan.GetSeconds()) ;
oleDatetime.m_dt= spanTwo.m_span;
a = oleDatetime.GetHour();
b = oleDatetime.GetMinute();
c = oleDatetime.GetSecond();
"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
Support CRY- Child Relief and you
|
|
|
|
|
|
Hello everybody,
I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII.
Here is my problem:
hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1, result is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal.
I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with VC++? (Help received! Thx)
Besides, I need to convert the output to ASCII string format, which is "Z0500" and "Z0510" respectively, how can I do that?
Your help is very much appreciated, thank you!
Here is the code with help from forum member, but my second question is not yet solve:
#include <iostream>
#include <atlstr.h>
#include <string.h>
#include <sstream>
#include <conio.h>
#include <ctype.h>
int main()
{
long long h;
long long h1 = 0x5A30353030LL;
long long h2 = 0x5A303F3F30LL;
long long h3 = 0x100LL;
CString Str;
unsigned char Write_Buff[1];
for (h=h1; h<=h2; h+=h3)
{
_tprintf_s(_T("%I64X\n"), h);
Write_Buff[0] = h;
Str.Format("0x0%x",Write_Buff[0]);
Sleep(10);
}
_getch();
}
|
|
|
|
|
What does "ASCII String Format" mean? I have found ASCII String Format and ASCIIZ searching on the web, and both refer to a simple C String. Here is an example that does that:
// Configuration Property: Character Set should not be set to
// Unicode, where _TCHAR = char
// Or, you can undefine _UNICODE and UNICODE
#include <stdio.h>
#include <tchar.h>
#include "stdafx.h"
#include <vector>
int _tmain(int argc, _TCHAR* argv[])
{
long long h1 = 0x5A30353030LL;
long long h2 = 0x100LL;
long long h3 = h1 + h2;
std::vector<_TCHAR> buffer(256);
int result =
_stprintf_s(&buffer[0], buffer.size(), _T("%I64X\n"), h3);
if (result == - 1)
_tprintf_s(_T("_stprintf_s faiiled.\n"));
else
_tprintf_s(_T("%s"), &buffer[0]);
return 0;
}
Also, is "Z0500" and "Z0510" some kind of command based on the above hex values?
|
|
|
|
|
Hi,
Thanks for the reply, here is what I finally wrote since 5A and 30 are kept constant.
unsigned long int z;
char buf[6];
z = 0x303530; // 5A-303530-30
do
{
buf[0] = 0x5A;
buf[1] = (z & 0xff0000) >> 16;
buf[2] = (z & 0xff00) >> 8;
buf[3] = (z & 0xff);
buf[4] = 0x30;
buf[5] = 0x00;
printf("%s\n", buf);
serial.Write(buf);
z = z + 1;
if ((z & 0xff) > 0x3f)
{
z = (z + 0x100) & 0xffff00;
z = z + 0x30;
if ((z & 0xff00) > 0x3f00)
{
z = (z + 0x10000) & 0xff00ff;
z = z + 0x3000;
if ((z & 0xff0000) > 0x3f0000)
{
z = (z + 0x1000000) & 0x00ffff;
z = z + 0x300000;
}
}
}
Sleep(150);
}
while (z <= 0x353130); // 5A-353130-30
It's HEX addaition of 1 and output to RS232 by cserial, thanks anyway.;)
|
|
|
|
|
|
I'm trying to store around 3000 chars in CString object, by using += operator, and concatenating chars to the end of CString.
The problem: When it around 250 chars in length the concatenation stops to work.
My guess was it's some problem with reallocation (when the buffer gets resized), but I tried with custom class with string of fixed length, and concat stoped at the same point. Now I have no clue what could be the problem.
-- modified at 20:28 Saturday 2nd December, 2006
|
|
|
|
|
Milos Djokovic wrote: Now I have no clue what could be the problem.
It has nothing to do with what you've thus far described. A CString object can hold 231 characters.
Show a code snippet of the problematic code.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Here are some parts of code (complete func is quite long):
BOOL ReadTag(const CString& rTagName, CString& rValBuffer) {
...
LPTSTR chCurrent;
LPTSTR chPrev;
...
while(!tagFound) {
chPrev[0] = chCurrent[0];
this->Read(chCurrent, 1);
...
rValBuffer += chCurrent;
...
}
...
}
The function works fine at first, but then it just stops. It passes over "rValBuffer += chCurrent" statement without executing it.
|
|
|
|