|
I am using WNetAddConnection2 to connect to a remote system in the lan.when i am connecting i want it to connect to the remote in the application level but its getting connected in the user level. Is there any way to connect to the remote in the application level.
thank you.
KIRAN PINJARLA
|
|
|
|
|
What do you mean by "application level?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
What do you mean by 'application level' and 'user level' ?
-----------
Mila
|
|
|
|
|
when i am connecting to the remote system by typing the system ip in the windows startButton->run, i have to submit the user name and password.And if iam connecting from my application also i have to submit the username and password.
Now the problem is if first time i am connecting through my app and if i try to connect from strat->run its not asking for username and password because the system is already connected to this user. This can bring me a security problem.
I hope u understood my problem. Thankyou.
KIRAN PINJARLA
|
|
|
|
|
Hi,
If you trying to connect with WNetAddConnection2 and connection's already established, you get 1219 error code (if I remember). Then you can simply disconnect existing session by WNetCancelConnection2.
-----------
Mila
|
|
|
|
|
Hi there!
I'm working on an alarm monitoring app, which may show modeless popup dialogs when needed. All this works fine except when the main application window is iconic (== minimized). When the main window is iconic and a popup dialog is displayed, the popup dialog sort of becomes the main window of the application.
This is quite confusing, since when the user clicks on the application icon in the Start menu only the recent popup is displayed, but the main window is not restored. Right-clicking the start menu icon and selecting "Restore" does the trick, but is not too user-firendly.
Does anyone have ideas about how to handle the creation/display if the popups correctly? I've tried sending the dialogs a WM_SHOWWINDOW message with "parent closing" info, right after creation, but this doesn't seem to help.
Of course I could prevent showing these popups when the app is minimized, but that's not really the way to handle it. What I'm after is to have the popups behave like they do when there are popups when minimizing the main window; the popups are hidden when minimized and redisplayed when the main window is opened again.
Any ideas on this are greatly appreciated!
-Pete
|
|
|
|
|
The behavior looks weird because the dialog's parent window is hidden.
You could
a) Restore the main window then show the dialog
b) Don't restore the main window and use NULL for its parent window
c) Don't restore the main window, create the dialog, but don't show it
If you go with c), make sure the visible style is turned off in the dialog resource.
|
|
|
|
|
Thanks for a VERY quick answer, Mike!
I'll have to see what my my options are here and select the best one. I have thought about a), but not all these windows are probably such that they should restore the main window. I really didn't come to think of the main window being hidden, but of course it is! The button on the start menu isn't really the main window, but just a thingy representing it.
-Pete
|
|
|
|
|
hey my dear code project members,
i am having a problem trying to know the length of a wave file
i tried
mciSendCommand(wDeviceID,MCI_STATUS,MCI_TRACK | MCI_STATUS_LENGTH ,(DWORD)(LPVOID) &mciStatusParms);
actually i don't know how to initialize the MCI_STATUS_PARMS "mciStatusParms"
to get the length (duration) of the wave file
so is this the right way and how can i get it work
if it is not, wat is the right way to get the length of a wave file
thnx alot 4 ur time and concern
|
|
|
|
|
May it be a LAN or internet, How do we detect it? using VC++? anyway through Winsock?.
?
|
|
|
|
|
Check out InternetGetConnectedState()
|
|
|
|
|
Thanks Mike, and do we have any similar function in .net?
?
|
|
|
|
|
I have a class which is compiled to a DLL. When giving out the DLL, i give along the .h, .lib and .dll files.
.h File content (implementation in .cpp compiled to .dll and .lib)
class DLLTESTV_API CDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
int GetX();<br />
void SetX(int _X);<br />
private:<br />
int x;<br />
};
But, i do not want the end user to know any private members of my Class. Is there anyway
i can hide those? The private members are in the private: block in the .h file and are visible in my class declaration.
I want to ship .lib, .dll and .h like this
class DLLTESTV_API CDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
int GetX();<br />
void SetX(int _X);<br />
};
I have tried doing so (by deleting manually the private : int x line in the .h file used in a test program), and the programs executes fine but causes an error at the end. Removing that line causes a stack corruption error during runtime (with the compiled DLL in a test program).
Any suggestion how i can hide the private members (users cant modify them anyway, they are private!).
|
|
|
|
|
The way it is done generally is to provide an interface only: make your CDlltestV class inherits from an interface class (IDlltestV for example) which exposes only the public functions as pure virtual:
class DLLTESTV_API IDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
virtual int GetX() = 0;<br />
virtual void SetX(int _X) = 0;<br />
};
Then in your dll, you simply make CDlltestV inherits from this interface and you provide there the members and implements the functions.
The 'problem' is that you'll need to provide a function to will create an instance of this class and return a pointer to your interface:
DLLTESTV_API IDlltestV* GetClass()<br />
{<br />
return new CDlltestV;<br />
}
But if your code is well written, this shouldn't pose too much problems.
|
|
|
|
|
To Quote Marshall Cline : "Encapsulation is for code, not for people". You shouldn't try to hide it. The statement private says all there is to say. The best way to enforce proper use is to put all public functions into an abstract base class ("Interface"), derive from it, declare the constructor private and create a class factory that only returns pointers to the ABC. But people will allways see what's in there if you give out the headers. See here : How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?[^]
|
|
|
|
|
how about using a privite implementation, aka PImpl ?
in your header you make reference to a private class that is declared and defined in the source file:
in pseudo-code.
class MyClassImpl;
class MyClass
{
private:
MyClassImpl* m_pImpl;
public:
void DoSomething(){m_pImpl->DoSomething;};
};
class MyClassImpl
{
public:
void DoSomething();
protected:
};
|
|
|
|
|
The problem is that the header defines not only the object interface, but also the size.
By building the dll with one header (with private members) and building an exe with another (no private members) you are using a different a sized object in the exe. At best you will experience what you have - runs with error at end. Most likely the program would be corrupting data everywhere.
uus831 wrote: Any suggestion how i can hide the private members (users cant modify them anyway, they are private!).
This isn't true, all non-const data can be modified, private is just the class developer attempting to create a contract with other developers who use the class. Another developer can just mod your header and replace private with public, now they can compile/link without warnings/errors and modify the (originally) private members however they want.
So, your choices:
1. Include a dummy private variable (byte array) that is the same size as all your private/protected members (including padding due to alignment). This can be tricky and is not recommended.
2. Export as an interface, as others have suggested.
3. Export with full header, as most people do/suggest.
[EDIT]
4. As Maximilien suggested, or even easier, just have a pointer to a private state struct.
e.g.
struct Apvt;
class A {
Apvt *pvt;
public:
A( void );
~A( void );
...
};
typedef struct Apvt {
...
} Apvt;
A:: A( void ) { pvt = new Apvt; }
A::~A( void ) { if(pvt) delete pvt; pvt = NULL; } This is actually a fairly common method that i've seen and used before.
[/EDIT]
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thank you so much guys! Works exactly like I wanted it to! The private struct technique is the easiest. Now i'm going to try the interface way.
Thanks again.
Really appreciated it!!
|
|
|
|
|
LONGLONG Date; //number of 100ns intervals since January 1st 1601 at * 00:00 UTC
How can i convert this to COleDateTime (or some other date structures)
I don't believe in failure. It is not failure if you enjoyed the process.
|
|
|
|
|
... FILETIME Structure Link[^]
I don't believe in failure. It is not failure if you enjoyed the process.
|
|
|
|
|
Hi to all,
in one of my applications ,i have to add a treeview to a combobox,
i searched a lot to find an article on this, but unable to find.
plz friends suggeswt me,or provide the url on how to add treeview to a combobox
thx in advance
Nagaraju
|
|
|
|
|
|
Hi..
I want to write a SMTP protocol using sockets....can any one suggest me.
Thanks
-murad
|
|
|
|
|
Abbas Murad wrote: I want to write a SMTP protocol using sockets....can any one suggest me.
Learn the Simple Mail Transfer Protocol[^] and implement it using sockets.
|
|
|
|
|