|
TechCrazy wrote: maybe it was
but right now ,i created a account in target machine ,the same username and password with my machine, and the code worked !!!!
i still don't know why
Seems pretty obvious it was security related...it failed until you created an account on the other machine with the same credentials as the one you were running the program with.
I notice in your program that you prompt for a username and password, but then just use hard-coded values. That seems to be the single deviation between your program and this sample one in MSDN[^].
I think you need to do some reading, to understand how all this works, rather than taking a sample and poking it to try to get you get what you want.
|
|
|
|
|
|
Hi,
I'm working on a project with the following configuration:
- several static libraries (*.lib) which contains some services.
- MFC application which link to the above libraries in order to use it's services.
All of the projects stored in the same solution.
One of the static libraries contain a static array with a predefined size.
I know that if I add the header of that library to my MFC application project(the only project which is an executable file) and recompile the entire solution , the array will be allocated according to the specified size in the overriden file.
The problem is that now I don't have the libraries in my solution(instead - I only get the *.lib files),therefor, I can't recompile those libraries(and still - I need to change the size of that array from the MFC application project).
Is it possible?(Is there a compiler setting which I missed????)
With best regards,
Eli
|
|
|
|
|
You can't change the size of the array. The libraries only 'know' the size of the array that was in effect when they were originally compiled.
|
|
|
|
|
Hi experts!
well as i'm developping an advenced chat application using MFC winsock (VS2005) under windows Vista and windows XP, i faced some problems,i could solve some of it, however i couldn't solve other problems..
- the first problem is when the client opens a public chat room or any other window, the rest of application must stay responsive and the user can access it! the problem is when i use DoModal method for the dialogs or any similar method (that have it's own message loop!) the main window is not responding anymore!
- tried solutions:
i tryed UI threads but i still have the same problem!
wel hope you have a solution for me.. (maybe about Non-Modal dialog boxes or so..)
(just an example: i want sth like in yahoo messenger where the user can open many windows and still able to use the main window or any other window)
waiting for your answers
Some People dream of success while others woke-up and are working to get it..
|
|
|
|
|
For short, how to create many dialogboxes and the main window stays responsive and i can acces any shown window (like the messenger chat)
|
|
|
|
|
|
Thank's bro,
that's it, it works now..
|
|
|
|
|
Hi all !
I'm using the MFC sockets mechanism for TCP\IP communication (CSocket, Srialization ability etc.) in a Process that spawns some threads.
It works fine until I deliver the socket pointer to one of the threads created by this process so that it can use it to send messages through this socket too - the application then fails, and if I understand correctly it is since the only thread allowed to use this socket is the one created it (in my case the main process).
I'm looking for an elegant solution to this limitation (I can go around the problem in several ways but it might affect the complexity and run-time of the program).
Any suggestions ???
Thanks in advanced,
Amit
|
|
|
|
|
You secondary thread may possibly post messages to the primary one and let the latter do socket processing.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
...or you can stop using CSocket (it's really only a useful class for the most
basic socket application) and use CAsyncSocket instead.
If you'll be using the same socket from different threads, you'll want to use
events instead of window messages for socket notifications.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
AmitCohen222 wrote: if I understand correctly it is since the only thread allowed to use this socket is the one created it
Not exactly, it's got to do with a bug in MFC. See knowledge base Q193101[^] - I had a similar problem and calling AfxSocketInit() in each thread fixed it.
|
|
|
|
|
That bug appears only when linking statically, and is probably not the cause of the problem.
For a solution on using a CSocket object in a thread different from the thread that created it, see "How to pass a socket connection between threads in an MFC application in Visual C++" at http://support.microsoft.com/kb/175668[^]. Basically, you need surround the thread hand-off with calls to CAsyncSocket::Detach() and CAsyncSocket::Attach() .
Mike
|
|
|
|
|
Oh yes, I missed that point. You do need to detach the original socket.
|
|
|
|
|
plz help me with this code...
<br />
int a = 0;<br />
int p = 2;<br />
int q = 3; <br />
<br />
a += p ? q : 0;<br />
what does the last line mean?
i need to describe it into normal if-then-else form...
thanks all...
From Indonesia with love..!!
|
|
|
|
|
the form p ? q : 0 is
expr1 ? expr2 : expr3
means evaluate expr1. If it is not zero, the value of the whole thing is expr2; otherwise the value is expr3.
so, substituting 0 += 2 ? 3 : 0
since 2 ! = 0
0 += 3
a = 3
...
'g'
|
|
|
|
|
The code maybe translated into (see documentation [^]):
if ( p != 0 )
{
a = a + q;
}
BTW you really need a good C/C++ tutorial.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yaa...
you may be right...
thank to you guys for the help...
From Indonesia with love..!!
|
|
|
|
|
Hi,
i am using CListCtrl in Icon-mode. I am setting the item positions manually with ListView_SetItemPosition32().
I am having a strange bug, y-positions between 0xf000 and 0xffff are not set properly !
Is this a known bug or am i doing something wrong ?
|
|
|
|
|
Could you please post the relevant code?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The code is pretty easy, i did this inside my CListCtrl class:
...
ListView_SetItemPosition32(this->m_hWnd, 0, 0, 0xf100);
POINT p;
GetItemPosition(0, &p);
...
and you will see that p doesn't contain the values i set before!
|
|
|
|
|
Did you use of debugger?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Debugger doesn't help much, because the item-position is sent via SendMessage to ListCtrl.
So its something going wrong inside windows api and not a fault of mfc.
|
|
|
|
|
This simple code fails and there is no extended error message.
The BITMAP data is there and correct.
CBitmap *bmp = new CBitmap();
if(!bmp->CreateBitmapIndirect((BITMAP * ) m_Doc->m_lpBi))
{
.....
PS Ignore -> it is "->" in original!!!
Any constructive suggestion on how to debug this is appreciated.
Thanks for reading.
Cheers Vaclav
|
|
|
|
|
Did you install the CRT and MFC source code? If so, you can step into the MFC implementation code (so long as you're working with a Debug build) and find what Win32 call is failing. That might give you some more information.
Only thing I can think of, apart maybe from finding some sample code, to see if there's anything you're missing?
|
|
|
|