|
Hi All,
I have two DLLs. One is an MFC extension dll that is using MFC serialization with CArchive. Another one is a COM component. I am using MFC DLL from COM DLL in order to initialize some data. Data is supposed to be serialized. However, MFC serialization fails in MFC code when it tries to find a runtime class object in a list of its runtime classes. It cannot find one and returns NULL which then throws an exception. When I use MFC DLLs from another MFC application to do exactly the same thing (serialize data on the same class), everything works perfectly fine.
Should I do something else when I use MFC DLL from COM component? Please note, COM component has been created to support MFC.
I will appreciate any help on this subject.
Thank you All.
|
|
|
|
|
Hi,
I'm working on a chat program that uses TClientSocket & TServerSocket.
With these I guess the only way to send 'loose' information is with Socket->SendText and for FileTransfer use Socket->SendStream...?!
Now I've made a protocol, something like:
-Client opens connection to server<br />
-Server Acknowledges<br />
-Client sends login-request (LOGIN, USERID, USERPASSWORD, USERIP)<br />
-Server returns if user == ... etc
...okay, what is the best option to send this? With a String, a Buffer or...?! And IS this a good way to do this at all?!
And then what is the best way to 'read' the protocol...
With switch() or with if's... or a better way?
Thx a million in advance,
Jeroen(NL)
|
|
|
|
|
|
I have scanned msdn for a level 9.0 or 9.0b DirectX SDK that's available on CD and can't find it. The product is available as a 200+ MB download, but I would only do that if I were leaving for a two day holiday! Does anyone know where I can obtain a CD containg DirectX (for C++/MFC and Win32 development).
Many thanks for any help in this regard.
TFB
|
|
|
|
|
I have it on CD, it came with a book I got on DX 9.0 Rendering Engines. It's the DX 9.0a SDK I'm pretty sure. I've got the 8.1 SDK too if you like. If you'd trust me with an address I suppose I could mail you a burned CD of it. Wow, it'd actually be legal too since it's a free DL anyway! Just use the contact link on my website below to get in touch if you care to.
The question "Do computers think?" is the same as "Can submarines swim?"
DragonFire Software
Jeryth
|
|
|
|
|
Thanks Jeryth, I'll email you my address! I visited your website and think it's looking great. Thanks again!
Tom
|
|
|
|
|
So I've got a DirectX Project that rotates some polys around. My problem is that I get compile errors saying PI is an undeclared indentifier. I've got the #include cmath statement ( BTW anyone know how to get the <> brackets to show up in code statements? ) and if I hover the cursor over a PI anywhere I get a tooltip "#define PI 3.14159...." Any idea what the problem is?
The question "Do computers think?" is the same as "Can submarines swim?"
DragonFire Software
Jeryth
|
|
|
|
|
Not sure why your code won't compile. However, how about using this expression for defining pi?
const double PI = 4 * atan(1.0);
Kevin
|
|
|
|
|
And to get the bracets show in these messages, use their HTML escape sequence codes. For > it is "& + gt;" and for < it is "& + lt;" (Remove the + sign, the quotes and write the entire sequence togeter in order to actual display it)
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I just bought a PocketPC today, it is a HP iPAQ 2215 with
Windows Mobile 2003 OS and Intel PXA225 400MHz CPU.
Then I couldn't wait to download the SDK, then....
I downloaded the Microsoft Windows Mobile 2003 SDK from
Microsoft website, then it said in order to use VC++, I also
need to install eMbedded Visual C++ 4.0 and its service pack
before installing the SDK.
So I installed the eMbedded Visual C++ 4.0 and its service
pack 2, then I installed the SDK.
However after installing the Windows Mobile 2003 SDK, it only
contains the Pocket 2003 Emulator. The SDK itself is a console
application. It is prompting the SDK's tool directory. (it reminded
me the Java SDK) Isn't the Pocket PC 2003 SDK supossed to be
windows-based?
Then I opened the eMbedded Visual C++ 4.0, it looks exactly like
the Visual Studio 6.0 environment.
But I saw some people can use VS.Net environment to develop
the Pocket PC. There is also no new project type when I open
the Visual Studio .Net 2003.So I wonder if I have downloaded
the wrong tools? How can I use VS.Net to develop the Pocket PC?
Besides, on the SDK website, it said it can use C# and VB.Net
language. Why do I only get the Emulator and the console
prompt?
|
|
|
|
|
You have the right bits.
If you want to develop in C++ for Pocket PC 2003, you must use eMbedded Visual C++ 4.0 SP2. The SDK contains a great deal more than what you describe; the documentation and samples are installed to C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003 (IIRC, don't have it installed here). eVC 4.0 looks exactly like Visual C++ 6.0 because it basically is - it's just been adapted a bit to support device development.
If you want to develop in VB.NET or C#, you need Visual Studio .NET 2003, and you must install the Smart Device Extensions from the VS.NET 2003 CDs. At present you cannot use VS.NET to write Pocket PC applications in C++ (feature coming in "Whidbey", I believe).
|
|
|
|
|
I've been looking for a WIN32 multithreaded server sample for quite some time now. I've found a few on Codeproject and some on Codeguru, but none of them explained how to get past my biggest problem. They all seem to start some sort of acceptor that fires off a client thread for handling the client, but then it just waits for the client to disconnect, or for an error to occur. The thing that is never explained, and which i can't find a solution for is what if we need to boot a client from the server?? I mean, how can we let a client thread know that it has to stop looping and handling the client in a normal way? (I'm talking strictly win32 code, blocking mode)
I've thought about doing a select in the client thread so it could occasionally check for a flag wether as to exit or not. But this turned out to be rather messy and i'm sure there is some better way, that also would influence the performance a little less.
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
The thing that is never explained, and which i can't find a solution for is what if we need to boot a client from the server?? I mean, how can we let a client thread know that it has to stop looping and handling the client in a normal way?
Do you mean, you don't know how the client thread know when to exit?
You're calling recv() in a loop, parsing the commands, if there is an exit command, then exit thread (and clean up, send exit response or what ever...) and if recv() returns 0 it means the other side closed the connection.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
No no no, thats exactly what i don't mean. I mean disconnecting the client from the server, from the server side. Like booting, kicking a client, whatever u want to call it. Manually that is.
Kuniva
--------------------------------------------
|
|
|
|
|
I see, but that depends on your code. You can just call closesocket() on the socket and then it will close. Save all your clients in a std::vector or std::list (whatever) and iterate through it to find the specific client and call closesocket().
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Yes, but it appears that, when that clientthread is blocking on a recv() call to wait for data, and i close the socket using closesocket() , the recv() call continues to block. Eitherway, my clientthread did not exit when i closed the socket, even though i check for a return value of recv() which is not equal to 0.
Kuniva
--------------------------------------------
|
|
|
|
|
Hi,
I have a main view with a tool palette which floats above it. When I launch any modal dialogs (such as file opening dialogs) they appear below the palette.
I've got over this by using SetWindowPos to remove the TopMost style using &CWnd::wndNoTopMost. This seems to be the only way to stop it sitting above the dialogs. However, the side effect is that the palette disappears behind my main view. I want to be able to remove its TopMost status but still have it sit above the main view rather than disappearing all together. Can anyone help?
Many thanks,
Simon
PS Is there a way of specifying modal dialogs to have the TopMost window style?
|
|
|
|
|
Yeah.
Remove the window style which causes it to float above others. Then, everywhere in your application where windows are moved, resized or new dialogs are launched, use SetWindowPos to arrange your windows. Place the dialog window to the topmost with &CWnd::wndTop, then place the tool palette window after that (pass the dialog's CWnd pointer as the parameter), place the mainframe window after that (pass the tool window's CWnd pointer as the param) and so forth.
Modal dialogs are always topmost in your application. If you specify a dialog to be system modal, then it will always be a top window until it is closed. Of course, you can always use SetWindowPost as well. After all, CDialog is derived from CWnd..
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Your tool palette should be placed on a CDialogBar, then all above problems will disappear.
A dialogbar actually behaves like a modeless dialog
Derive your toolbox class from CDialogBar, place controls on it in the dialog editor just like with a dialog, and create it in CMainFrame::OnCreate
if (! m_ToolPaletteBar.Create(this,IDD_TOOLPALETTEBAR,CBRS_RIGHT,IDD_TOOLPALETTEBAR))
{
TRACE0("Failed to create tool palette bar\n");
return -1;
}
m_ToolPaletteBar.EnableDocking(CBRS_ALIGN_RIGHT);
A window is topmost if it has the WS_EX_TOPMOST style. You can modify this style in the CREATESTRUCT struct's style member, override PreCreateWindow function for setting it.
Peter Molnar
|
|
|
|
|
Using VC++ to read a very large image such as 20000 X 20000, If it has 3 band, then each pixel occupies 3 bytes,the image size would be over 1 G bytes,how to read and process it, I have tried file mapping to read it, but I think it is not very stable, and if I want to process it using different filter algorithm continually and display the result quickly,how to deal with the redo and undo operation,should I write a temp file? so does anyone has good idea, thanks in advance.
swandream
|
|
|
|
|
Read in data partially from your bitmap file, then process this data, then read in some data again...
See CFile::Read and CFile::Seek functions.
Peter Molnar
|
|
|
|
|
I don't think it is so simple as you said, how to orgnize those partial datum and display them while paning and zooming quickly, how to process the image, get display result quickly, and when the display part is changed, how to add the current process method to the new partial image, including undo and redo implementation, so it is a little complicated, though not so difficult.
swandream
|
|
|
|
|
You say you wanna display an image of 20k pixels x 20k pixels, and your user's screen resolution is only 1k x 1k pixels (just for simplicity) (GetDeviceCaps gives the current resolution) then you can
1.
display the pic in its original size (i.e.:20k x 20k). Of course the user will see only a tiny part of it in 1k x 1k (1/400th part), and he can use the scrollbar to navigate it.
In this way you keep all the pic in memory, so your user will have more memory than your pic consumes, in order to be able to use you program efficiently.
2.
read in 20 pixels from file both horizontally and vertically, and make 1 pixel out of it according to an algorithm (maybe taking the average of RGB values), and this about 1 million (=1k x 1k) times.
So you will be able to construct and show a 1k x 1k image out of a 20k x 20k image. This pic will fit the user's screen.
This method does not consume memory but enormously consumes CPU capacity.
3.
Another method would be if you read in from file every 20th pixel both horizontally and vertically (ignoring 19 out of 20 pixels), and show only the 1k x 1k image in this way.
This mehtod does consume neither memory nor CPU, but this image shows 20x20 = 400 times less data (i.e.:resemblance) with the original 20k x 20k pic. Could be a good way if you have pics with large homogenous areas.
Whatever way you choose, you have to make sacrifices, because of the confines of the current Win32 system. I am sure there will be no sacrifices with Win128 or Win256, but it entails some sacrifices of time...
Peter Molnar
|
|
|
|
|
thank you Peter Molnar for your reply, but your methods could not satisfy my request
for the first method you metioned, it is obviously difficult to keep all the pic in memory,20k X 20k RGB image could occupy more than 1G disk space, to make memory more 1G is very luxery.
for the second and third method, I think it only suit for creating navigation image.
swandream
|
|
|
|
|
You need to break your image up into say 1k x 1k tiles and process those separately. You'll notice most paint programs will render really large images in tiles.
Todd Smith
|
|
|
|
|