|
putting it in the directory worked. thanks.
general programming practice question:
once this utility is complete, it will need at least 20 more dlls for the different printer libs. what i was trying to do was link each lib from their path in the repository. will i have to add each dll to the executable directory, or is their a cleaner way so when the libs are updated i wont have to recopy the dlls.
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
Linking the import libraries is done at build time so you're fine there. If it links, you're
good!
Runtime, however, you'll need to make sure the DLLs are in the paths indicated by the search
sequence I mentioned.
Loading DLLs at runtime with LoadLibrary (Run-Time Dynamic Linking)[^], you have more flexibility
since you can specify a path that's stored in the registry, or better yet, stored where you're
supposed to - in the shell "special" folders.
In this case though, the DLLs are bound at link time (Load-Time Dynamic Linking)[^] so you'll
need to have the DLLs available somewhere in the search path. The exe folder is always easiest
but not always convenient. Modifying the PATH environment variable is an installation-time
thing - so is specifying a current directory at application startup. With newer security issues,
I'm not sure what the current stance is on putting them in the Windows system directory. That
used to be where everyone dumped all their common DLLs
Whatever best fits your needs (vague, I know)
*edit* Also search on "DLL Hell" for more info and tips on avoiding it )
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thanks man. much appreciated
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
You're welcome! Good luck
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi
How can I paint a button,tab control etc.For example I want to change the color of background and text of a button.I saw that CWnd::OnCtlColor method was used in somewhere but I couldn't apply it in my project.How can I use this method or how can I change colors of controls easily.
Thanks
|
|
|
|
|
WM_CTLCOLORBTN you can set a button's text and background color
WM_CTLCOLOREDIT for edit control
WM_CTLCOLORLISTBOX for listbox
|
|
|
|
|
In my application i am using stretchblt bitmap function. it works fine in windows xp and 2000. But it fails in windows 98. Can anyone help me to solve this?
|
|
|
|
|
fails how? Can you post the code you use to set up the DCs and make the StretchBlt call?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
This is the code i am using
pClientDC->StretchBlt(iUnitXPos, iUnitYPos,iDisplayWidth, iDisplayHeight, pMemDC, iMemDCXStart, 0, iOrigBmpWidth, iOrigBmpHeight, SRCCOPY);
where,
pClientDC - window dc which comes from ondraw function of the view.
pMemDC - memory DC created as follows
pMemDC = new CDC;
pMemDC->CreateCompatibleDC(pClientDC);
Thanks
|
|
|
|
|
Assuming pClientDC is valid, you can check (as Blake suggested) for StretchBlt capability
like this:
if (pClientDC->GetDeviceCaps(RASTERCAPS) & RC_STRETCHBLT)
{
// StretchBlt supported
}
else
{
// StretchBlt NOT supported
}
Also make sure all passed parameters are valid.
If StretchBlt returns FALSE, what does GetLastError() return?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks.
I found a problem with the parameters i passed to the stretch blt function and corrected it. Now the bitmap is displayed in windows 98.
I am facing some other problem. CDC::DrawText function crashes sometimes.
|
|
|
|
|
PrabhuDev wrote: I am facing some other problem. CDC::DrawText function crashes sometimes.
Are all the passed parameters good? Do you get any assertion and/or error message?
What does the code look like?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have developed my application in Xp. I am running only the release build in windows 98. This is the function i am using to display the text.
DisplayText(CDC* pDC, const CRect& rect, const CString& strText)
{
ASSERT(NULL != pDC);
int iPrevMode = pDC->SetBkMode(TRANSPARENT);
COLORREF clrTextColor = RGB(255, 255, 255);
pDC->SetTextColor(clrTextColor);
CRect rectDisplay = rect;
rectDisplay.NormalizeRect();
CString strTextOut = strText;
pDC->DrawText(strTextOut, rectDisplay, DT_CENTER|DT_SINGLELINE|DT_BOTTOM);
pDC->SetBkMode(iPrevMode);
}
sometimes the function crashes in the drawtext function.
|
|
|
|
|
Are all the passed parameters good?
Do you get any assertion and/or error message? What do you mean by "crashes"?
Is the HDC valid in pDC? Try adding ASSERT(NULL != pDC->GetSafeHdc()); to check.
Run a debug build on the 98 machine. Running a release build makes your ASSERTs useless.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Maybe not supported by video card - I think you are supposed to check that out first.
I think we ended up using CopyBlt or something like that to 'stretch' it - the stretchblt call is not always supported direcly on Windows 98. I tmight be up to the video driver to support it, and some don't.
|
|
|
|
|
Hi!
I am working on a 3D engine for an RTS game using DirectX 9 and I have decided that I will be making the engine modular using .dll files for parts such as the renderer. The problem with this, is that the game is going to have a multiplayer aspect and therefore, I need some way to verify the integrity of a .dll file such as "renderer.dll" to ensure that the file has not been replaced with a third party .dll (basically a hack) that can display wireframe views or remove the fog of war, etc.
The reason I am making the engine modular is so that users will not have to download large updates to fix small issues, but can instead simply download the updated .dll that corresponds to the error fix.
So far the only method I have come up with for this error checking is to either simply redownload all files every time the user launches the game (horrible idea), or to somehow check the file against the server copy.
So I was wondering, do you guys have any ideas of how to achieve this?
|
|
|
|
|
Keep a table of DLL->MD5 mappings. If one does not match, then refetch the offending DLL. Update this table as your DLL are changed at the server. Just download the table and do the check each time. No need to get all the files that way.
|
|
|
|
|
Keeping MD5's (or some other hash/signature/digest) on the server and then comparing as Blake Miller suggested is what I would recommend as well.
However, the paranoid in me would also suggest that you compare the MD5s at different parts in the game, just to help keep hackers at bay. For example, check not only at launch/startup to download the correct versions, but also verifying the signatures of different binaries at specific time intervals during play (check only, do not download because the game is in progress).
Just my $0.02...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for your replies guys! do you have any articles on those topics? Doing a quick google, I have recovered an article from wikipedia.
http://en.wikipedia.org/wiki/MD5[^]
This is what the article has to say on MD5: In 1996, a flaw was found with the design of MD5; while it was not a clearly fatal weakness, cryptographers began to recommend using other algorithms, such as SHA-1. In 2004, more serious flaws were discovered making further use of the algorithm for security purposes questionable.
So, should I be using this if these serious flaws really do exist? The article states that a citation is needed for this information, and as such it may not be true, however I really can't take chances with something so vital to the game.
-- modified at 3:08 Wednesday 18th April, 2007
|
|
|
|
|
MD5 would likely still be fine for what you need to use it for - you are not dealing with highly secure messages or financial data/transactions (right?), and someone would still have to try pretty hard to duplicate a MD5 hash. Chances are that a hacker will spend less time trying to bypass the security than finding a useful collision. It is your choice to use something like SHA-1, of course.
I have used the Tiger hash for things like this for a while...
If you use something like Crypto++[^], it should be easy to try different algorithms as you develop the product.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
HI,
AFX_ID_PREVIEW_CLOSE is the ID of button to close printpreview, i search the afx message sended by this button.
AFX_ID_PREVIEW_PRINT call the command ID_FILE_PRINT catch in :
BEGIN_MESSAGE_MAP(CViewPrintPreview, CView)
//{{AFX_MSG_MAP(CViewPrintPreview)
ON_COMMAND(ID_FILE_PRINT, &CViewPrintPreview::OnFilePrint)....
BUT I search to map AFX_ID_PREVIEW_CLOSE, i try with ID_FILE_CLOSE but no effect.
Do you have a solution?
THANKS
|
|
|
|
|
Hi,
if i open a CDialog in a thread, which is destroyed after the execution-block, the debugger
alers that the memory of the variable (of the dialog) is corrupt.
Are windows always created in another thread as the current?
Normally, i create the object in a thread, which is in the thread-allocated-memory and all
operations are done in the "thread-memory".
Is it different for windows, probably because of the messageloops and other window-related-objects?
Thanks
PS: So i need to send a message to my general thread which opens the dialog-window?
|
|
|
|
|
I do so sometimes and it works. Actually, no strange thing in this, sometimes we have to do smth like openning a dlg in a thread. But beware, you should be careful in interthread communications. If your code crashes, abviously smth goes wrong in the code; is the dlg in the heap or stack or how do you destroy it?
--
======
Arman
|
|
|
|
|
thanks for your reply
i create a base-thread-class which is derived from a CWinThread.
Then i set a String-variable to the specially value of the task f.ex. "ListCustomers"
After this i post a message to the thread an there'in he checks the variable and starts
in deppension of the value the correct function ( which realises the task )
After the task is done, the thread post a message to the window and says "I'm ready"
That's the background of my thread-structure...
In a specific task i need to open a DialogBox, like this :
DOptions dlg(NULL,"showInfo");
dlg.DoModal();
at the end of the function, dlg will be killed, there the error-message appears.
|
|
|
|
|
baerten wrote: at the end of the function, dlg will be killed, there the error-message appears.
Are you freeing something in the destructor of the dialog class. If so is the pointer valid.
baerten wrote: After this i post a message to the thread an there'in he checks the variable and starts
in deppension of the value the correct function ( which realises the task )
After the task is done, the thread post a message to the window and says "I'm ready"
You should use AfxBeginThread to start off a thread. If you want it not to start the use CREATE_SUSPENDED option. Then later when you want it started call ResumeThread .
|
|
|
|