|
SPowers wrote: what are critical sections?
A synchronization object clickety[^]
|
|
|
|
|
Hello again
I have a question : What is a handle ?
Is it something like pointer ?
What is difference for example between HWND and a Cwnd ?
Please give me some explicit explanations.
Thank you.
|
|
|
|
|
big_denny_200 wrote: What is a handle ?
A handle is a unique serial number for Windows (and managed by Windows) to identify an instance (or a system object like a window, an event, a timer, a mutex, ... ).
big_denny_200 wrote: What is difference for example between HWND and a Cwnd ?
HWND is a handle: the concept to Windows programming.
CWnd is a class type: the concept to C++ language. This type is defined in MFC Library.
-- modified at 16:58 Friday 2nd June, 2006
class CWnd has a data member of type HWND.
Maxwell Chen
|
|
|
|
|
Hi All,
I need help to find some info of how to develop in visual C++ and VOIP .
I looked in this site and didn't find something really helpful.
Please help me.
Thanks.
|
|
|
|
|
If you are not an experienced Visual C++ developer I suggest you tackle that problem first and in isolation from the VIOP problem.
|
|
|
|
|
I know C++ and i have a lot of experience with visual C++.
I just need some example to know and learn how to use the classes of VOIP.
I don't know nothing about VOIP - and i want to learn - i thought that with some code example i could learn.
Can someone help me ?
-- modified at 16:43 Friday 2nd June, 2006
|
|
|
|
|
yanshof wrote: some example to know and learn how to use the classes of VOIP.
Maybe try THIS LIBRARY[^].
Maxwell Chen
|
|
|
|
|
Hello again
Please someone explain me next situation
I have next code :
...
const UINT SIZE = 5;
TCHAR strDest[SIZE];
LPCTSTR strSource = _T("cool");
_tcscpy_s(strDest,sizeof(strDest)/sizeof(TCHAR), strSource);
CString s(strDest);
MessageBox(s);
...
Everything works fine, but I get some differences in Debug and Release builds.
Specifficaly, in Release build, in debugger when I look at contents of strDest after _tcscpy_s function, I see that, first 4 bytes of it are occupied by come strange characters and 5th byte is 'c' , but anyway the resule is displayed correctly in Message box.
In Debug build everything happens as expected : first 4 bytes are occupied by 'c' 'o' 'o' 'l' and 5th byte is '\0'
Why is this difference ?
thank you.
I have VS2005
-- modified at 14:21 Friday 2nd June, 2006
|
|
|
|
|
The first 4 bytes of a CString are taken up by an DWORD (unsigned long) that holds the size of the buffer. You should see that in both the Debug and Release builds, but the Debugger may move the pointer to the first part of the character buffer when it is built in Debug. If you check the memory at &strDest, you should see similar results for both.
Also, if you intend to place the results of 1 CString into another, you don't need a character buffer.
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
|
|
|
|
|
Looks like that this is bug in visual studio debugger
This strange symbols are nothing else than the pointer to the "cool" string in your resource section(.rdata usually) of executable. In debugger window you see destination buffer address decremented by 4 bytes. I don't know why this happens, but I think that this is bug.
|
|
|
|
|
I am creating a service along with a sys file to aid me in writing to the parallel port data byte. Iam using the code segement given below.
Ser = CreateService (Mgr,
"hwinterface",
"hwinterface",
SERVICE_ALL_ACCESS,
SERVICE_KERNEL_DRIVER,
SERVICE_SYSTEM_START,
SERVICE_ERROR_NORMAL,
"System32\\Drivers\\hwinterface.sys",
NULL,
NULL,
NULL,
NULL,
NULL
);
How ever if i change the term "hwinterface" to say "mydriver". It stops working neither does the sys file get created nor does it interface with the port. Furthermore, the Description of the file is set as buzz driver and copyright is to Buzz corporation why is this happening and how do i change the service name and its associated attributes to say Description: "My ParallelPortDriver"
Copyright to "MYcompany".
any help in this regard would be great.
sharath
|
|
|
|
|
Sharath86 wrote: if i change the term "hwinterface" to say "mydriver". It stops working neither does the sys file get created nor does it interface with the port.
The "service name" (the argument for CreateService API) should match the Symbolic Link Name registered from somewhere in AddDevice in the driver.
The reason for the above is because it (CreateService) creates a link. A link must have a concrete destination (aka in the driver).
On the other hand, the "display name" argument for CreateService API can have a different name.
Maxwell Chen
|
|
|
|
|
Hi Guys,
I have this exam on Data Structures in C. I need some help wiht Binary Trees. I found the follwing code for Binary Tree Traversal abnd its perfect. It's a recursive implementattion. I need a non recursive version too. Could someone tell me where I coulfd find it.
<br />
<br />
<br />
void Pre_order (struct NODE *Node)<br />
{<br />
if (Node)<br />
{<br />
printf(" %c", Node->Info);<br />
Pre_order(Node->Left_Child);<br />
Pre_order(Node->Right_Child);<br />
}<br />
}<br />
<br />
<br />
<br />
void In_order (struct NODE *Node)<br />
{<br />
if (Node)<br />
{<br />
In_order(Node->Left_Child);<br />
printf(" %c", Node->Info);<br />
In_order(Node->Right_Child);<br />
}<br />
}<br />
<br />
<br />
<br />
void Post_order (struct NODE *Node)<br />
{<br />
if (Node)<br />
{<br />
Post_order(Node->Left_Child);<br />
Post_order(Node->Right_Child);<br />
printf(" %c", Node->Info);<br />
}<br />
}<br />
|
|
|
|
|
Non-recursive traversals use a stack similar to the following (going off memory here, so it may not be exact):
<br />
void traverse (struct NODE *Node)<br />
{<br />
stack<NODE*> travStack;<br />
NODE* cur = Node;<br />
while (NULL != cur)<br />
{<br />
travStack.push(cur);<br />
printf(" %c", cur->Info);
cur = cur->Left_Child;<br />
printf(" %c", cur->Info);
while (NULL == cur && FALSE == travStack.empty())<br />
{<br />
cur = travStack.pop();<br />
cur = cur->Right_Child;<br />
}<br />
printf(" %c", cur->Info);
}<br />
}<br />
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,
I have some problems with managed Strings as function parameter.
See:
void f(int& x, String* s)
{
x=10;
s="hello"
return;
}
.....
String *s ="start";
int x= 0;
f(x,s);
....
Problem:
s doesn't get the new vale "hello"
is it possible to use a managed String in a function by reference ??
Thx
|
|
|
|
|
|
Hi all
Please help, I have next code :
I am building in Unicode
TCHAR array[100];
CString strText = _T("Cool");
_tcscpy_s(array,
sizeof(array),
strText
)
But the program halts and hangs, when performs _tcscpy_s method.
thank you
-- modified at 11:16 Friday 2nd June, 2006
|
|
|
|
|
There's no problem in the snippet of code you have shown. The error, presumably, lies elsewhere.
Regards,
Nish
|
|
|
|
|
big_denny_200 wrote: But the program halts and hangs, when performs _tcscpy_s method.
How are you verifying this?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Since _tcscpy_s is expanded to wcscpy_s call in Unicode version, you must specify the size of destination buffer in 2-byte unicode characters, not in bytes. Universal solution can look like this:
_tcscpy_s(array,
sizeof(array) / sizeof(TCHAR),
strText);
You got halts even if the source string was short enought, because -- in Debug version -- this function fills the buffer with 0xFD value.
-- modified at 11:33 Friday 2nd June, 2006
|
|
|
|
|
Try explicitly casting the CString object:
<br />
TCHAR array[100];<br />
<br />
CString strText = _T("Cool");<br />
<br />
_tcscpy_s(array,
sizeof(array),
(LPCTSTR)strText
);<br />
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
|
|
|
|
|
(Actually, explicit casting from CString to LPCTSTR is not required even in printf -like calls -- at least in VS 6.0).
|
|
|
|
|
Could you be more explicit ?
MSDN says, that second parameter of wcscpy_s must specify size of destination buffer in bytes, therefore in Unicode build destination size will be 100 * sizeof(TCHAR) (which is equal to sizeof(array) ), but in you case it will be 100(which is not the size of destination buffer)
I am little confused.
thanks
-- modified at 12:02 Friday 2nd June, 2006
|
|
|
|
|
It shouldn't be, but I've run into problems with it converting (implicitly) to char* instead of wchar_t* when I didn't explicitly cast it.
Looking back at the code again, I think he will run into another problem though. In non-UNICODE builds, he shouldn't notice anything, but in UNICODE builds, the sizeof(array) will actually return twice the size of the actual buffer. I believe the wstcpy_s function requires array size in elements, not bytes (I'll have to double-check that though). If I'm correct, he would just need to change that line from sizeof(array) to sizeof(array) / sizeof(TCHAR) .
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
|
|
|
|