|
Can any body help me i'm try to create in CDocument view an Rich edit control that will that will allow me have a line count on the side when the user type any thing into the edit. Also beside the CRichEdit I want the color to be gray and white for CRichedit. SO i kind of looks like Visual Studio Editor or any coding editor.
Can anybody help me to get this going.
Thanks alot.
|
|
|
|
|
This is probably a stupid question (I haven't had much sleep in the past 3 days).
How can I tell Visual C++ to perform an extra step when compiling each .cpp file. What I want to do is basically what BoundsChecker does when you perform a compile. You see "compiling something.cpp" followed by a line reading "instrumenting something.cpp".
I know about custom build steps but I can't seem to get this to do what I want???
|
|
|
|
|
|
Hi All.. I have a global variable CArray < struct, struct&> a; declared in the same place as theApp global variable get declared.
I know if I want to use the global variable include in the other .cpp files, I have to call that global in such way
extern CArray<struct,struct&> a;
Then I Rebuild the project, Iand got linking error...
[code]
error LNK2001: unresolved external symbol "class CArray<struct dishinfo,struct="" dishinfo="" &=""> theMenu" (?theMenu@@3V?$CArray@UDishInfo@@AAU1@@@A)
Debug/ResturantSystem.exe : fatal error LNK1120: 1 unresolved externals
[/code]
why do i get error??
|
|
|
|
|
First of all, to fix this problem, declare the variable extern in your stdafx.h, and declare it in stdafx.cpp. Voila, visible everywhere.
Secondly, DON'T do this. Global variables are a terrible idea. If you must, then at least put them in a namespace. It's far better to make them members of your main window and access them that way.
Finally, you should investigate std::vector, check out the STL articles here on CP. CArray is really a terrible product, and is generally used by people who either don't know about the STL, or are put off by the awful docs in the MSDN. I've solved problem a, and the articles on this site will fix problem b. I think you'll be surprised how much nicer/powerful it is than the stuff that MFC ships.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thank you very much for your explaining and suggestion.. I'll learn about STL..
Thank you Chris...
|
|
|
|
|
Glad to help.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
whats wrong with my string?
I am trying to find a record in a database where one parameter is partially given ( LIKE 'm_val'). I don't get any database errors, but no info either.
CString m_cat, m_val;
// Build the SQL statement
SqlString = "SELECT * "
"FROM new WHERE cat='";
SqlString += m_cat;
SqlString += "' AND filename LIKE '";
SqlString += m_val;
SqlString += "*'";
Any helps really appreciated
shotgun
|
|
|
|
|
I believe the wildcard character is %, that is, I know % works, but I've never tried *. Do your values start with m_val, the ones you expect to find ? Are they in the table called 'new', and in the 'filename' column ?
I find the best way to isolate this sort of problem is to build the query. Do a select *, a select cat, a select * where cat equals a known to be present value, etc.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian is right - '*' won't work as a wildcard but '%' will.
-Alex;)
|
|
|
|
|
On MSDN, in documenation for API structures, the following examples are common:
typedef struct _RASDIALPARAMS {
DWORD dwSize;
TCHAR szEntryName[RAS_MaxEntryName + 1];
TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1];
TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1];
TCHAR szUserName[UNLEN + 1];
TCHAR szPassword[PWLEN + 1];
TCHAR szDomain[DNLEN + 1] ;
#if (WINVER >= 0x401)
DWORD dwSubEntry;
DWORD dwCallbackId;
#endif
} RASDIALPARAMS;
Apparently (WINVER >= 0x401) refers to Windows NT 4.0 with enhancements and on this platform, the last 2 entries are required. However, Windows 98, whose version is 4.10 doesn't require them ...
Isn't 4.10 > 4.01? Or am I not understanding something?
Thanks
A reasonable man adapts himself to the world. An unreasonable one persists, trying to adapt the world to himself. That is why all the progress in the world depends on the unreasonable men.
|
|
|
|
|
The project is to simulate a Finited State Machine running with a specific input sequencr. Just highlight the path it goes through.
The problem is to set a Pause button to stop and restart it. How??? Do I has to use thread?? If yes how to
( My view class is base on CScrollView )
Thanks!!
|
|
|
|
|
Does anyone know of a function/routine to tell me how many files are on a disk drive? Can't find anything in MSDN.
|
|
|
|
|
I would use the FindFirstFile and FindNextFile .
You specify "*" as filter and then count the files. This way you also can count only specific files with specific extensions, or only count directories.
I don't know of any function which directly returns the number of files on a drive.
-Dominik
|
|
|
|
|
Thanks for the help. I thought of also doing that but it would be pointless since I need this number to be set for a progress bar which is active during searching of the hard drive for files so it kind of defeats the purpose of doing that twice...any other ideas?
|
|
|
|
|
Another idea:
First step: Get the used size on the disk (capacity minus free space). Use this function:
BOOL GetDiskFreeSpaceEx(<br />
LPCTSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailableToCaller,
PULARGE_INTEGER lpTotalNumberOfBytes,
PULARGE_INTEGER lpTotalNumberOfFreeBytes
);
Second step: Every time you process a file, subtract its size from the space.
Now you can compute the remaining bytes to process. Set this into relation and make a nice status bar.
-Dominik
|
|
|
|
|
Thanks, that should do it...why didn't I think of that?!
|
|
|
|
|
Sorry to bother again but I seem to be running into a problem with the GetDiskFreeSpaceEx function:
This is what i used:
GetDiskFreeSpaceEx("c:\\", &iFreeBytes, &iTotalBytes, &iTotalFreeBytes);
and these were my results:
iFreeBytes = 1711489024
iTotalBytes = 0
iTotalFreeBytes = 1697718272
Can't really figure out the problem...right clicking on drive c in explorer gives me freebytes as above (the first arguement) and for the drive capacity i have 5,992,685,568 bytes. Is there anything that I'm overlooking?
|
|
|
|
|
When you print the results you can't just use %d specification since you're dealing with 64-bit values. Try a format string of "%I64d" and I'm sure you'll see quite a change.
|
|
|
|
|
Hello,
I have a problem. I want use the glGetString function to get the vendor, version and extension strings. But this doesn't work.
My project does not need an OpenGL window. I don't need to draw anything. I just want the information by glGetString. You can think of a system information tool.
I LoadLibrary("OpenGL") the OpenGL library and then get the function using GetProcAddress(g_hOpenGL, "glGetString") .
But glGetString always returns zero.
If I replace "OpenGL" with "GLU32", and replace "glGetString" with "gluGetString", so not using the main OpenGL library, but instead the utilities library, the functions work fine.
But the utilities library supports fewer information (just version and extensions).
How can I get the glGetString function work?
Do I have to initialize a window to make the glGetString function work? Or did I miss something?
Any idea?
Thank you!
-Dominik
|
|
|
|
|
Was "OpenGL" just a typo?
You should LoadLibrary("OpenGL32.dll") and nothing else.
Also, if you always need to do this you could equally well statically link with the opengl32.lib import library and get rid of the LoadLibrary and GetProcAddress calls.
|
|
|
|
|
Can anyone tell me a function/routine to find out the number of files on my hard drive...I didn't find anything in MSDN...Thanks is advance.
|
|
|
|
|
|
This is a programming question - how ?
The reason is that people have been coming onto CP and downloading the whole site, which is expensive for the site and not the idea of the site.
Personally, I think it's great. I don't get why people would be so lazy as to not create an account. It costs nothing and does not even require a valid email address. If you're not going to participate in this site at all, and just take the code provided, that's fine by me ( really ), but why wouldn't you at least give Chris another number to show potential advertisers how much traffic the site gets. It's the least you can do for the amount of free code you're able to download here.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
good then I do not spend my time as unregistered anymore.
|
|
|
|