|
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
cyn8 wrote: actually i modify the code pasted here as the original code is too long.
So how are we supposed to help if the code snippet does not match what you are referring to?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I didn't change the OnBrowse function,but only simplify the OnLoad function. So the scenario should be the same.
|
|
|
|
|
cyn8 wrote: CString ext=m_binfile.Right(3);
This is assuming the rightmost 3 characters are the extension. What if they are not? Use PathFindExtension() instead.
cyn8 wrote: binfile=binfile.Mid(binfile.ReverseFind('\\')+1);
Use PathFindFileName() here.
cyn8 wrote: file[0]=0;
Unnecessary initialization.
cyn8 wrote: When i debug, i found out that under outputdata>_Fb>_Str, _Str value is 0x00000000 {???}.
When, and where? What value should it have?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
By using PathFindExtension() and PathFindFileName(), the error"error C2039: 'PathFindExtension' : is not a member of 'CString'" is generated.
And "When, and where? What value should it have? "
,the value should be{""} instead of{???}.
Is there any hope?
|
|
|
|
|
cyn8 wrote: By using PathFindExtension() and PathFindFileName(), the error"error C2039: 'PathFindExtension' : is not a member of 'CString'" is generated.
I never implied they were CString methods.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hey guys,
im trying to build a project with a .lib file included. however, when i try to run the project i get
"This application failed to start because _______.dll was not found. Re-installing the application may fix this problem"
under properties -> librarian -> general, i have the library under "additional dependencies" and under "additional library directories" i have the file path to the library...
any ideas?
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
Is this with VS6 or VS200x?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
this is with VS2005
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
VonHagNDaz wrote: under properties -> librarian -> general, i have the library under "additional dependencies" and under "additional library directories" i have the file path to the library...
These are build-time settings.
The error is a run-time error - the system can't find a dll the application requires to run.
Where is the missing DLL?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
the dll file is in the folder containing the lib, which is a separate folder than the project
------------------------------
I win because I have the most fun in life...
|
|
|
|
|
It should work if you move the dll to the same folder as the exe.
The documented search path order for dlls at runtime is:
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. Windows Me/98/95: This directory does not exist.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
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.
|
|
|
|