|
Hi,
To use StrStrI, I
#include "shlwapi.h"
#pragma comment(lib, "shlwapi.lib") // link to shlwapi.lib
MSDN states: "shlwapi.dll 4.71 or later" (and, basically, IE4 must be installed)
However, on 98SE, even with IE6 installed, I get:
"missing export Shell32.dll:StrStrIA"
What's wrong? Do I need to write my own StrStrI? (I need to support 98, IE4 is no problem)
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
Because of the final "A", it sounds like a problem of ANSI/UNICODE versions of the function
is your code built UNICODE?
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
no, it's a straight MFC/ANSI build.
I'm a little bit confused by the dll name mismatch.
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
You probably need to define WINVER to be 0x0400 or 0x0500 or something like that
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
I have a controller program working like this. controller is set as a time event 1000/sec. But the "current_trials", sometime increments, even the controller doesn't go into state 1. why? Thank you.
controller()
{
static clock_t start_time, end_time;
if(state==1)
{
position= get_position();
set_force(position);
if(position > 10.0)
{
start_time= clock();
state = 2;
}
}
if(state==2)
{
end_idle = clock();
idle_time = (end_idle - start_idle);
if (idle_time >= IDLE_DURATION)
{
start_idle = end_idle = 0;
state=3;
}
}
else//state=3
{
position=get_position();
if(position < 0.5)
{
load_force_spatial_profile();//this is time consuming
state = 1;
current_trial++;
}
}
}
|
|
|
|
|
What is state intialised to, and where?
Also, your states are best described by an enum
e.g.
enum MyStates {ms_timing = 0, ms_loading, ms_state_to_be_defined, ms_error, ....};
This will make your program much more readable for yourself and others in the future.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hello!
I wonder how you Gurus are managing all Error Messages in a large project?
I think that each Message should have a unique number, severity, text in current language, ... What else?
Do you number all error messages sequencially discarding severity or do you have one sequence per serverity?
Do you use the Message Compiler (mc)??
Are there any add-in for Managing Error Messages?
All input is valued!
Cheers!
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
Mike, sounds like you are asking about logging eh? There are as many ways to log as there are people to answer the question
You might consider using the OS log mechanism if that makes sense for your product. Otherwise you can do whatever you want. I've done logs with a UDP socket and a database for persistance. I've also done logging directly to disk files using XML.
You really need to consider your project specific requirements for logging. The main consideration in some projects like server side projects is to get logging working day ONE! Makes life simpler.
-pete
|
|
|
|
|
Thanks for your answer!
No, I not specifically talking about logging. I'm talking about Error Messages, which most of the time just get display via an dialog. I'm also talking about multiple languages and the importance of a unique error number.
I do application which are translated into English, Swedish, Finnish. If a user calls/emails me with an error and the error messages is in Finnish, I have no clue on what the error is, since I don't speak or read Finnish. If I have a unique error number then I just look at the Swedish error message and usually I understand it
The above scenario is one major drawback of Windows, which has all error messages translated into different languages. So I use a Swedish Windows, then I get Swedish error messages, which I have to translate into English in order to find any info about the error ...
My original question was more of how to manage/administrate these error numbers, messages and how to use then in a MFC environment.
Cheers!
Mike Eriksson
Sonork 100.21825
|
|
|
|
|
I looked around and found this http://support.microsoft.com/default.aspx?scid=kb;EN-US;231777
which shows how to make an ERD (emergency repair disk). But I dont know if this also backs up my registry.
Also while running the backup utility does one have to shut down all apps? Or can one keep working and let it do its stuff in the background? The aricle doesnt say....
Thanks
Appreciate your help,
ns
|
|
|
|
|
Not sure about Win2K, but it certainly backs up the registry in Win98.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hi,
I'm wondering where to get info on how to burn files on a cd. I didn't find a SDK or API or something like that.
I want to make a simple app to create and burn files on multi-session cds.
-widi
-
|
|
|
|
|
|
Thanks.
I guess I didn't find something in MSDN because I'm still using the version of '98.
|
|
|
|
|
|
|
How can I use the compiler and linker from vc6 in a batch file?
I never run the batch from inside the vc/bin folder. This results in missing c++ dll's.
example:
- folder c:\testapp
inside folder:
- test.h
- test.cpp (including test.h, windows.h, iostream.h)
- compile_link.bat
What do I have to put in compile_link.bat to compile and link these sources to a win9x DLL? (and to a win9x-app also...)
TNX
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
the easiest (if you already have a VC++ .dsp project file) is:
start /w MSDEV.EXE project.dsp /MAKE "myproject - Win32 Debug" /OUT buildlog.log
make sure MSDEV and all other stuff is in your path (VC++ setup creates a vcvars32.bat somewhere that registers the environment vars...)
Either make the project folder your current directory, or specify a full path to the project file (.dsp)
Make sure you specify the correct target name behind the /MAKE command.
Advantage: it respects onn your VC++ customization and project settings (including VC++ Tools/Options/Directories, and project post build commands, etc.)
You could create a project by using the project wizard for a DLL, then add your own source files.
You can also add other options (like REBUILD to force a complete build)
Another option would be creating a MakeFile - but I've been lucky in my life to largely avoid that...
Tip: make sure the target names are distinctive. I had one case, with darget names
"foo - Win32 Release" and "foo - Win32 Release ATL", where, upon specifying /MAKE "foo - Win32 Release" it would build the wrong target. renaming the first target to "foo - Win32 Release MFC", and specyfing this in the make command did fix it.
Nur wer feige ist tötet Liebe durch das Wort allein [sighist] | [Agile Programming] [doxygen] If you look for evil in me you will find it whether it's there or not.
|
|
|
|
|
I have nothing, no dsp.., except the source files (*.cpp) and header files (*.h)
But vcvars32.bat was the file what I was looking for. I copied that file to my batch folder and added a call to lc at the end, including the source folder. It worked fine
tnx
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
Hello,
I have a tree view in a sdi app.. After a short period of time of extensive use my tree view turns black in color and if you were to open internet explorer etc none of the pictures show until my application is closed.. I have a feeling its a GDI leak in my OnPaint function.. This problem only happens on 9x machines and unfortunately there is no way to look at the GDI resources on 9x (that I know of).. Here’s my OnPaint function, anyone see anything wrong?
void CMyTreeView::OnPaint()
{
CPaintDC dc(this);
CDC memDC;
memDC.CreateCompatibleDC(&dc);
CRect rcClip, rcClient;
dc.GetClipBox(&rcClip);
GetClientRect(&rcClient);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
memDC.SelectObject(&bitmap);
CRgn rgn;
rgn.CreateRectRgnIndirect(&rcClip);
memDC.SelectClipRgn(&rgn);
rgn.DeleteObject();
CWnd::DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0);
HTREEITEM hItem = GetTreeCtrl().GetFirstVisibleItem();
int n = GetTreeCtrl().GetVisibleCount()+1;
while(hItem && n--)
{
CRect rect;
UINT selflag = TVIS_DROPHILITED | TVIS_SELECTED;
Color_Font cf;
if (!(GetTreeCtrl().GetItemState(hItem, selflag) & selflag)
&& m_mapColorFont.Lookup(hItem, cf))
{
CFont *pFontDC;
CFont fontDC;
LOGFONT logfont;
if(cf.logfont.lfFaceName[0] != '\0')
logfont = cf.logfont;
else
{
CFont *pFont = GetFont();
pFont->GetLogFont(&logfont);
}
if(GetItemBold(hItem))
logfont.lfWeight = 700;
fontDC.CreateFontIndirect(&logfont);
pFontDC = memDC.SelectObject(&fontDC);
if(cf.color != (COLORREF)-1)
memDC.SetTextColor(cf.color);
CString sItem = GetTreeCtrl().GetItemText(hItem);
GetTreeCtrl().GetItemRect(hItem, &rect, TRUE);
memDC.SetBkColor(GetSysColor(COLOR_WINDOW));
memDC.TextOut(rect.left+2, rect.top+1, sItem);
memDC.SelectObject(pFontDC);
}
hItem = GetTreeCtrl().GetNextVisibleItem(hItem);
}
dc.BitBlt(rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(),
&memDC,rcClip.left, rcClip.top, SRCCOPY);
bitmap.DeleteObject();
memDC.DeleteDC();
}
Thanks,
Rob
|
|
|
|
|
You never select anything OUT of your DC s.
That is, the GDI objects remain there, even if their handles (contained in the C++ objects) are gone.
The right sequence (as taken from the Prosise-book) is
pGDIObject* pOldObject = myDC.SelectObject(pMyObject);
..use myDC..
myDC.SelectObject(pOldObject);
pMyObject.DeleteObject();
myDC.DeleteDC(); This way you can be sure that all of your GDI objcets can be be destroyed when its variables go out of scope.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
use your example instead of the following?
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
memDC.SelectObject(&bitmap);
|
|
|
|
|
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
.
.
.
memDC.SelectObject(pOldBitmap);
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
|
CGDIObject* works with any GDI Object:
The CGdiObject class provides a base class for various
kinds of Windows graphics device interface (GDI)
objects such as bitmaps, regions, brushes,
pens, palettes, and fonts. <small>from MSDN</small>
My opinions may have changed, but not the fact that I am right.
|
|
|
|