|
Ok using the unsigned char worked for the display but the send function in winsocks asks for a char *, how do I go about getting sending a single byte of 255 through ethernet using winsocks.
|
|
|
|
|
To be honest, I have no clue. I won't pretend that I know anything about winsocks, but IF (and that's a big if) all it has to do is with type conversion, you can simply cast it on the send, and cast it back when you receive it.
|
|
|
|
|
Thanks for the help I took my unsigned char array and cast it as char * in the send function and it all works now.
Thanks for all the help!!!
|
|
|
|
|
Hi guy this is so lame i cant pass parameters between classes, i feel like commiting sucide (
anyways
I have used a public variable in say class A
Public:
long iSelPackageItemID;
and assigned the value in function...
setPackageID()
{
iSelPackageItemID=some value;
}
then i have declared a function
long getPackageID()
(
return iSelPackageItemID;
)
after a long long time i call the function getPackageID()
from some another class say B and i am getting garbage value i.e. getPackageID() is returning garbage.
Whatever is the solution i just want the value from iSelPackageItemID in class B which is assigned in class a.
|
|
|
|
|
Maybe you have casting problem. post the code when you call setPackageID from your B class (before taking any action for suicide )
|
|
|
|
|
No casting since all the variables are long. I checked in the debug mode that the value is retained in the class as along the variable is in scope, but garbage value is assigned once the value goes beyond the scope. I guess i need to increase the scope of variable to application variable.. How do i do it...?
|
|
|
|
|
I dont know how exactly u had written the class,
I assumed some and written like this..
class A<br />
{<br />
public: <br />
long iSelPackageItemID;<br />
<br />
A()<br />
{<br />
<br />
iSelPackageItemID=100;<br />
}<br />
<br />
setPackageID()<br />
{<br />
iSelPackageItemID=200;<br />
<br />
<br />
}<br />
long getPackageID()<br />
{<br />
return iSelPackageItemID;<br />
<br />
}<br />
<br />
<br />
};<br />
<br />
class B<br />
{<br />
public:<br />
A ob1;<br />
<br />
<br />
<br />
};<br />
<br />
int main()<br />
{<br />
<br />
<br />
B ob2;<br />
A ob;<br />
cout<<ob.getPackageID()<<endl;<br />
<br />
cout<<ob2.ob1 .getPackageID ()<<endl;<br />
<br />
<br />
<br />
return 0;<br />
<br />
}
if ur code is similar to this than u got the solution.
If this the right solution that ur problem is,
u had given some valsue to iSelPackageItemID in the setPackageID() method, but when u create the onject to class A or B, ur members functions will not call and the valuse of setPackageID is not intialised, so give valuse to setPackageID either in constructor or call the setPackageID() function before calling getPackageID()<< method.
|
|
|
|
|
Well i solved the problem time being.
by declaring
extern long iSelPackageItemID in the .h file
and long iSelPackageItemID in .cpp file
i got help from here http://www.codeguru.com/forum/showthread.php?threadid=427587
But the core OOP funda remains unanswered, i know this is going beyond the scope but just for knowledge sake. I am also working in java and i haven't seen such kind of syntax, also in a desingning book it stated not to use a global variable since it voilates the basic rules of OOP. So is the above code a good programming practise...?
|
|
|
|
|
How are you creating "some value"? The first thing that comes to mind is that it is a variable that has gone out of scope between when you assign it and when you try to reference it.
Judy
|
|
|
|
|
I am not clear on this thing ... but now it looks like pretty much that it's going out of reference. My OOP fundas are weak... but just one question when i assign a value to a class member A, then i declare an obj of class B so when i try to access the member from a through B does it go out of scope..?
|
|
|
|
|
I'm not saying that the member itself of class A goes out of scope, I'm suggesting that what was assigned to the member went out of scope. The member itself is still good but it is referncing memory that is no longer good .You see this a lot with objects created on the stack. For example:
char *MyCreateFunc ()
{
char buffer[256]
// do all the stuff to fill in buffer
return buffer;
}
The statement
A::m_memberVar = MyCreateFunc ();
will compile and execute and may even work as expected sometimes. However, it is wrong!! A::m_memberVar remains in scope but what it points to is no longer in scope because the memory containing the data is no longer valid once the MyCreateFunc returns.
Show the code where you create the value assigned to the member of class A. The member variables of a class remains in scope until the class itself goes out of scope, so unless you're accessing class A incorrectly, the problem has got to be in the value assigned to the member variable.
Judy
|
|
|
|
|
I have an application in visual c++ relating to client and server. this appliaction does many types of work like getting all user names logged on to computers,remote shutdown,remote logoff, getting the remote desktop view and many others types of functioning related to "lan monitoring" through server. but for this , client application has to be executed all the time whenever any user logon through his local account.
but the problem is that I couldn't find any way to execute the "client exe" automatically whenever any user logon through his/her local account.But I could execute the client exe automatically for the administrator by making changes in the registry but I have to execute it "for all users".
So please help me to find any way to execute the client exe for all users automatically whenever they logon through their local account.Is there any win api or by making any registry changes or any program which can call the exe automatically whenever any user login.
ps:since this is all a part of a domain so all the other users are less priviliged than admin
HELP HELP URGENT SITUATION
RAHUL CHHABRA
|
|
|
|
|
Why not just add it to the Startup folder for All Users?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The application you are describing would seem to operate best as a service.
Check out "Start Your Windows Programs From An NT Service" by Xiangyang Liu. This article seems to be very popular here on codeproject.http://www.codeproject.com/system/xyntservice.asp[^]
Best Regards,
Randor (David Delaune)
|
|
|
|
|
Hello, I have a property sheet that I want to check whether a specific page is Active or not. How can I get IDD of associated dialog resource in a property page I tried following code but GetDlgCtrlID() fails (returns 0). By the way I don't think it is important but anyway the property sheet is embedded in a CFormView
<br />
int nID = pDoc->m_sheetProperty.GetActivePage()->GetDlgCtrlID();<br />
if(nID == IDD_INTERESTING)
{<br />
...<br />
<br />
}<br />
thanks
|
|
|
|
|
Why does your CPropertySheet object belong to the document class rather than the view class?
Electronic75 wrote: )//nID is always zero
As it probably should be. GetDlgCtrlID() is for returning the ID of controls on dialog boxes or property pages.
I've never known it necessary to query a dialog box's ID. In any case, I'd be more inclined to compare the return value of GetActivePage() with the class objects associated with the various pages. For example:
CPropertyPage *p = pDoc->m_sheetProperty.GetActivePage();
if (p->IsKindOf(RUNTIME_CLASS(CMyOtherPage)))
...
else if (p->IsKindOf(RUNTIME_CLASS(CTheLastPage)))
...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi David, Well it is a MDI application that I did bizarre things to make it look nicer. eg. it has a property page embedded in a CFormView and even another CDocTemplate(Doc, View, Frame) embedded in one of the pages. It maybe bizarre but it looks good!
|
|
|
|
|
Hi,
I am trying to run my code in a different system, which is working on my system. But it gives me this error. I checked the path for afxhelp.hm...its correct and is fine...
Can anybody help me with this error please....
Here is the entire copied error message.............
*****************************************************************
Copying contents file...
1 file(s) copied.
Making help include file...
Making help file...
hlp\OperationTool.hpj(1) : error:
Microsoft (R) Help Compiler
HCRTF 4.03.0002
Copyright (c) Microsoft Corp 1990 - 1995. All rights reserved.
operationtool.hpj
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_SYSTEMCONFIGURATION" is the same as the map value for "HIDR_CSMENU".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_SYSTEM_CONFIGURATION" is the same as the map value for "HIDR_CSMENU".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_CLIENT_CONFIGURATION" is the same as the map value for "HIDD_CONFIGURATION".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_CHANNELCONTROL" is the same as the map value for "HIDD_CHANNELPARAMETERS".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_CHANNEL_CONTROL_DIALOG" is the same as the map value for "HIDD_CHANNELPARAMETERS".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_RESEND_CONTROL_DIALOG" is the same as the map value for "HIDD_RESENDCONTROL".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_DATA_CONTROL_DIALOG" is the same as the map value for "HIDD_DATACONTROL".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_MAC_CONTROL_DIALOG" is the same as the map value for "HIDD_MACCONTROL".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_EVENT_LOGGER" is the same as the map value for "HIDD_LOGGER".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_CONNECTION_PREFERENCES_DIALOG" is the same as the map value for "HIDD_CONNECTION_PREFERENCES".
HC3037: Warning: D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.hm :
The map value for "HIDD_CONFIGURATION_SETTINGS_DIALOG" is the same as the map value for "HIDD_CONNECTION_PREFERENCES".
HC1002: Note:
Using existing phrase table: OperationTool.ph.
HC3025: Warning: topic #1 of D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\.\afxcore.rtf :
Jump to undefined Topic ID: "menu_record".
HC3025: Warning: topic #3 of D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\.\afxcore.rtf :
Jump to undefined Topic ID: "HID_OLE_EDIT_LINKS".
HC3025: Warning: topic #3 of D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\.\afxcore.rtf :
Jump to undefined Topic ID: "HID_EDIT_PASTE_LINK".
HC3025: Warning: topic #3 of D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\.\afxcore.rtf :
Jump to undefined Topic ID: "HID_OLE_INSERT_NEW".
HC1010: Note:
The following mapped Topic IDs were not used in any topic:
AFX_HIDP_UNREG_DONE
HID_CONNECTION_CONNECT
HID_TOOLS_EMT_LOGSAVE_ON
HID_SYSTEM_USER_STATUS
HID_TOOLS_EMT_LOGSAVE_OFF
...// so on..i have removed them here
...
...
HID_CLOSE
HID_OTHERCONTROLS_DATACONTROL
72 Topics
48 Jumps
16 Keywords
21 Bitmaps
Created D:\Sridhar\Official\NGN\NGN_3\kcj\ngn\OperationTool\hlp\OperationTool.HLP, 38,928 bytes
Bitmaps: 5,348 bytes
Phrase+Zeck compression decreased help file by 13,866 bytes.
Compile time: 0 minutes, 0 seconds
2 notes, 15 warnings
Compiling resources...
Compiling...
StdAfx.cpp
Compiling...
Generating Code...
Linking...
OperationTool.exe - 1 error(s), 15 warning(s)
Please respond soon.
Thanks,
Sridhar
|
|
|
|
|
Hello all,
class A:
Function x
class B:
Function y
I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class
A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem.
Regards
|
|
|
|
|
Maynka wrote: I have already declared object of class B in class A to access member function y of B.Now i have to access function x in class B.In fact i have to take the return value of one function of class
A and give it as input to one function of class B.Then mutally creating objects is giving errors,how to overcome the above problem.
Why not show the actual class definitions? Your paraphrased version makes no sense.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Why dont you derive one class from another so you can use the function y from class A for example?
Have you declared pointers inside each class?
|
|
|
|
|
Hi..
are you including header files in both classes, i mean..
in A.h
#include "B.h"
and in B.h
#include "A.h"
if u give so definately u will get errors,
so include only in the first written class .
and in secondly written class just define the first class
class A;
try this hope it works..
|
|
|
|
|
Hai...
i am developing application like chat. In this i have added font styles like(bold,Italic,underline and size.) if i chose some of the styles and typing in my richeditbox so the respective styles font s are coming. now i want to send the text with same style fonts in chat history richedit box.
but now it is sending without styles only.
how to do that...
|
|
|
|
|
Here is how I am doing it.
In the header...
COLORREF m_lLogClr[4];
//In the constructor..
m_lLogClr[0] = RGB(0, 0, 0);<br />
m_lLogClr[1] = RGB(142, 35, 35);<br />
m_lLogClr[2] = RGB(218,165,32);<br />
m_lLogClr[3] = RGB(35,35,142);<br />
Finally...
<br />
<br />
VOID CLogDlg::PostLog(TCHAR *pBytes, int iClr, int iSize)<br />
{<br />
if(NULL != pBytes)<br />
{<br />
m_RichLogCtrl.HideSelection(TRUE, TRUE);<br />
int iLen= m_RichLogCtrl.GetWindowTextLength();<br />
m_RichLogCtrl.SetSel(iLen, iLen);<br />
<br />
CHARFORMAT cf = {0};<br />
cf.dwEffects |= CFE_BOLD;<br />
cf.dwEffects &= ~CFE_AUTOCOLOR;<br />
cf.cbSize = sizeof(CHARFORMAT);<br />
cf.dwMask = CFM_COLOR | CFM_FACE | CFM_SIZE | CFM_BOLD | CFM_CHARSET;<br />
cf.crTextColor = m_lLogClr[iClr];<br />
<br />
_tcscpy(cf.szFaceName, _T("MS Sans Serif"));<br />
cf.bPitchAndFamily = FF_SWISS;<br />
cf.yHeight = (iSize * 1440) / 72;<br />
<br />
m_RichLogCtrl.SetSelectionCharFormat(cf);<br />
m_RichLogCtrl.ReplaceSel(pBytes);<br />
m_RichLogCtrl.SetSel(iLen, iLen);<br />
m_RichLogCtrl.HideSelection(FALSE, TRUE);<br />
}<br />
}
|
|
|
|
|
Hi all,
I want to integrate Logging into my existing project.I want to generate a file in which i can log all the action data inside project.Is there any sample project which explains how to do this.
Regards,
|
|
|
|