|
such as:
UINT u=which_function_can_convert("FF00FF");
thx
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Use strtoul() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
UINT u = strtoul("0xFF00FF", NULL, 16);
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
In a puzzle game, I dont know the size of the puzzle, how do I know the index number of the target element for swapping, at this moment I just know the index number of h is (hrow, hcol).
Am I wrong if I think this way?
e.g.
C | B
A | h
Assume the location of h at the keyboard is always on 5, then I hit 4 to swap h with A, hit 8 to swap B with h, and hit 7 to swap C with h.
For swapping A
tar_row = hrow;
tar_col = --hcol;
For swapping B
tar_row = --hrow;
tar_col = hcol;
For swapping C
tar_row = --hrow;
tar_col = --hcol;
Am I wrong?
|
|
|
|
|
eivanlo wrote: Am I wrong?
Maybe. However, to be completely sure, I would not rely on the operator -- precedence in an assignment, (such as tar_row = --hrow; ), but take two steps to do it (tar_row = hrow; hrow--; )
~RaGE();
|
|
|
|
|
Hi to all,
I made a deep search in this and other sites about serial communications management in Win32 (Win9X,2000,XP)
All the results leads to using ReadFile and the other file-style functions
But is any way to use interrupts (int of received char) on Windows?Must I create a device drivers?
Thanks to all
Cristian
|
|
|
|
|
misturas wrote: ReadFile
Mmmh .. .really ? What are you trying to achieve exactely ?
~RaGE();
|
|
|
|
|
Yes, sure. What is the problem with that ? Reading and writing data on the serial port is done with ReadFile and WriteFile.
|
|
|
|
|
Hi Cedric,
I was doubting the fact that ReadFile and WriteFile was the _only_ method provided to read/write data under Windows. Not that it does not work.
~RaGE();
|
|
|
|
|
|
I use Visual C++ 6.0 and I studied the article "Serial Communications in Win32" of msdn
My question is a question my boss made me I know it's not very easy to interact with hardware at low level on Windows and all the articles I found uses overlapped operation and ReadFile/WriteFile to read/write COM ports
Now in Italy is 6 p.m., so I have to leave office
Sorry if I don't reply immediately
Thanks in advance
|
|
|
|
|
misturas wrote: Now in Italy is 6 p.m
Really ? I am sitting in Germany, and it is still 5 p.m. Did not know that Germany had a different time than Italy.
As for serial communication, there are lots of wrappers that consider the serial port as a file with read/write operation. This is very handy for serial communication, but not for your purposes. I think what you are looking for is a way to get the hand when a serial interrupt is called (as we used to do under DOS or on microcontrollers). I think this should be feasible with the API I have provided you with, in this case you must get a Windows message as soon as something lands on the serial buffer.
~RaGE();
|
|
|
|
|
Maybe it would help a lot if you describe exactly what you want to achieve. In general, reading and writing to a serial port can be done by several ways (specifically for reading). You can use a loop with timeouts (in a separate thread for example), ...
But if you want to really respond when there is an interuption, then you'll need to go for a device driver (and I suppose it must be tricky to do).
Anyway, even inside your driver, you will still have the problems of the real-time behavior, which is that Windows is not a real time operating system, so everything you want to achieve under the resolution of 10 msec (it can vary) is unfeasible.
|
|
|
|
|
If you want to be notified on receipt of a char, you can use overlapped I/O with your read. That way an Event will be signalled any time you receive a character.
You could put a receive loop in a separate thread, anf then post each characted received with a resgistered window message.
The choices may not be endless, but they are several!
Iain.
|
|
|
|
|
Ok, for rage, yes it was 5 p.m.
I know the way ReadFile Overlapped IO etc.
I was asking myself if there was a way of control interrupt the way dos/microcontroller do
I think the only suitable way is creating a device driver
It's better if re-study behavior of ReadFile,Events and Overlapped IO
Thanks to all
|
|
|
|
|
Hi fellows. I'm developing a program that returns the hwnd of all opened windows in the desktop. The problem is that function always returns 2 hwnd ID's. Can someone helps in this??
Thanks a lot...
void OpenedWindows(HWND hwnd)
{
HWND childWindow;
//is child of the desktop window???
if((childWindow = GetWindow(hwnd, GW_CHILD)) != NULL)
{
if(childWindow != NULL)
{
MessageBox(NULL, itoa(((int)childWindow), cVal, 10), "Is Child", MB_OK);
OpenedWindows(childWindow);
}
else
{
MessageBox(NULL, "No window child!!", "No Child", MB_OK);
}
}
else //Catch the next's window
{
childWindow = GetNextWindow(GetParent(hwnd), GW_HWNDNEXT);
if(childWindow != NULL)
{
MessageBox(NULL, itoa(((int)childWindow), cVal, 10), "Do Else", MB_OK);
OpenedWindows(childWindow);
}
else MessageBox(NULL, "Is NULL", "", MB_OK);
}
}
|
|
|
|
|
void OpenedWindows(HWND hwnd)
{
HWND childWindow;
if((childWindow = GetWindow(hwnd, GW_CHILD)) != NULL)
{
if (childWindow != NULL)
{
MessageBox(NULL, itoa(((int)childWindow), cVal, 10), "Is Child", MB_OK);
OpenedWindows(childWindow);
}
else
{
MessageBox(NULL, "No window child!!", "No Child", MB_OK);
}
}
else
{
childWindow = GetNextWindow(GetParent(hwnd), GW_HWNDNEXT);
if(childWindow != NULL)
{
MessageBox(NULL, itoa(((int)childWindow), cVal, 10), "Do Else", MB_OK);
OpenedWindows(childWindow);
}
else MessageBox(NULL, "Is NULL", "", MB_OK);
}
}
Why Getparent and not simply hwnd.
But anyway, I would not use clumsy recursion on the Z-order, but use GetDesktopWindow followed by EnumChildWindows , much more reliable IMO.
~RaGE();
|
|
|
|
|
Hi all
can any one tell me how to retreive the attributes of a paticular node in a Tree Structure which is derived from CTreeCtrl ,if i know the handle of that particular node ,in MFC
|
|
|
|
|
Use the GetItem() method.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
but what is the parameter for this GetItem( ) method
i ve Tree Structure as below
-Loop
-Slab=1
Slice=1
Slice =2
-slab=2
slice=1
slice=2
i want to explore all the items in a messageBox
( from Loop to slice=2)
for that one my code will be look like
for(i=0;i<(ptrTree->GetCount()); i++)
-- modified at 9:43 Monday 30th January, 2006
|
|
|
|
|
A pointer on a TVITEM structure. Here you go:
typedef struct tagTVITEM{
UINT mask;
HTREEITEM hItem;
UINT state;
UINT stateMask;
LPTSTR pszText;
int cchTextMax;
int iImage;
int iSelectedImage;
int cChildren;
LPARAM lParam;
} TVITEM, FAR *LPTVITEM;
See MSDN for more info.
Typical code snippet:
TVITEM tvi;
ZeroMemory(&tvi,sizeof(tvi));
tvi.hItem = YourItemId;
tvi.mask = TVIF_TEXT |TVIF_STATE;
m_TreeCtrl.GetItem(&tvi);
// Now tvi is fulled with the item's attributes.
~RaGE();
|
|
|
|
|
Thanku rage
but i m getting an error of
GetItem cannot convert parameter 1 from 'struct myClass::MyFunction:tagTVITEM *' to 'struct tagTVITEMA *'
|
|
|
|
|
Can you post the part of the code where you are doing the call ? Are you using MFC ?
~RaGE();
|
|
|
|
|
You've erroneously made tagTVITEM part of your class, which is unnecessary.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Good point David, I missed the myClass::MyFunction . He must have misinterpreted my thread and define the TVITEM I gave as an example. Never give too much information
~RaGE();
|
|
|
|