|
Derive a class from CView, say CView2, and add your functions to CView2
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi,
What is your perference when it comes to STL containers? I know many programmers prefer the vector because it random-access. However, deque container is random-access and could be changed from front, middle and back. I prefer the list, but it is hard for me to access specific data inside the list mainly because of my inexperience with STL. Nonetheless, I prefer list because of the innovative way it manages insert and delete (does not need to move all data).
I am implementing deque a program. The program reads data from a file line by line. The program saves each line of data from the file into a character array. I want to "push" each character array into a deque. At the end, I use the unique function to delete all clones. For example let say I have a file with the following:
-------
123
231
123
321
-------
First, the program reads one line at a time and copy the line into a character array. Then the program copies the entire character array into the STL container. Once the program has reached the end of the file, then it will delete all clones such as "123" from the above example.
How do you push a *character array* into an STL container, specifically a deque?
Thanks,
Kuphryn
|
|
|
|
|
Each container has its place, but I definitely find myself using vector more than anything else. As far as your problem goes, you can use std::string to do what you want, you also might want to consider just using set instead of a deque if you don't care about order (set will automatically remove duplicates).
Chris Hafey
|
|
|
|
|
FYI if you reserve() data in a vector it doesn't have to allocate after each new insert until you exceed it's limit. And at that point it usually allocates 2x it's current data size (1000 -> 2000 -> 4000 etc.)
std::vector<std::string> data(1000);
as for your deque you can use
std::deque<std::string> data;
ifstream infile("filename);
std::string temp;
while (!infile.eof())
{
infile >> temp;
data.push_back(temp);
}
Todd Smith
|
|
|
|
|
Thanks everyone.
I am not familiar with the set container. Can you post a straightforward example of set declaration and insert?
Thanks,
Kuphryn
|
|
|
|
|
Using Visual C++ 6, I need to programmatically, discover what type of keyboard (Serial or PS2) is used on a computer, and what type of mouse (serial or PS2) is used. This needs to be done on Windows 95/98/NT/2000 and XP.
|
|
|
|
|
This registry key might be useful
HKEY_LOCAL_MACHINE\Enum\ACPI
enumerate the subkeys
Nish
p.s. chk for class "Keyboard" and class "Mouse"
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi Nish
I see wrote register address for reply ...
But how can i use of that ?
I must read value of this register key ? with GetKeyValue and ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi
I was home when I posted that reply and I gave you the registry keys for Win 98. Now I find that for Win 2000 the keys are different.
For keyboard :-
Key - HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\KeyboardClass
Query this value - \Device\KeyboardClass0
It will return the registry address to find further info. On my machine I got this - \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\kbdclass
So I opened that key. By the way replace \REGISTRY\MACHINE\ with HKEY_LOCAL_MACHINE
Open the Enum subkey
Query this value - 0
I got this - ACPI\PNP0303\4&3ec904f&0
So now open this key below :-
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\ACPI\PNP0303\4&3ec904f&0
Now query this value - DeviceDesc
That will tell you what your keyboard is.
pretty long winded
I didnt chk for mouse. But it should be something similar
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi All,
How do I get the Friendly Name programmatically of the Name of my current Internet Connection,
currently being used!
eg MyHomeConnectionDun or
TheOfficeLan or
NewDSLConnection ?
Thanks for any and all assistance !
Regardz
Colin J Davies
Sonork ID 100.9197:ColinI live in Bob's HungOut now
Click here for free technical assistance!
|
|
|
|
|
Is there an API to add a header/footer to a PDF?
If so, where can I get it from?
I am not interested in an exe that does this for me.
I'd prefer a library or component that will allow me to programatically stamp all pages of a PDF with a header/footer.
I am prepared to buy a shareware/commercial control.
Regards
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Have a look at this page : http://www.pdflib.com/
|
|
|
|
|
Thanks Rick.
I am checking it out now
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I am trying to get the hang of programming dll's. I succeeded in compiling an example from the MSDN but the problem is i need to import the dll manually (without a .lib file) but it wont work. Here's the code for the DLL:
#include "stdafx.h"
extern "C" VOID assimGL()
{
MessageBox(NULL,"hello world from DLL!","DLL",MB_OK);
}
here's the code for the test app:
#include <stdio.h>
#include "stdafx.h"
typedef VOID (*MYPROC)();
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
//MessageBox(NULL,"hello","hello",MB_OK);
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
// Get a handle to the DLL module.
hinstLib = LoadLibrary("assimDLL");
// If the handle is valid, try to get the function address.
if (hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "assimGL");
// If the function address is valid, call the function.
if (fRunTimeLinkSuccess = (ProcAdd != NULL))
(ProcAdd) ();
// Free the DLL module.
fFreeResult = FreeLibrary(hinstLib);
}
if(!fRunTimeLinkSuccess)
{
MessageBox(NULL,"Link failed!","Failure",MB_OK);
}
return 0;
}
Can anyone please tell me whats wrong with it and how it WILL work for sure?
Thanks in advance
Kuniva
|
|
|
|
|
It appears that assimGL is not exported. It needs to have a __declspec(dllexport) statement in front of it.
Have a look at the DLLHUSK sample in MSDN. It illustrates this fairly well.
|
|
|
|
|
Also take note of the calling convention of the exported DLL function (i.e. __stdcall or __cdecl).
This will affect how the function name will appear in the export table of the DLL which will in turn determine whether function GetProcAddress() succeeds.
To keep things simple, always add a .DEF file to your DLL project and add a EXPORTS section to it. Then make sure that the function name "assimGL" is listed in this section. For example :
LIBRARY assimDLL
EXPORTS
assimGL
|
|
|
|
|
I am in need to place a hyperlink on a dialog. In want the user's browser to come up, when the link is clicked (just like a standard hyperlink to a HTM resource).
Is there an easy way to do this, or do I have to detect the mouse click, search for the default browser and spawn an instance of it?
Thank You
LP
|
|
|
|
|
There's an MFC hyperlink class here. WTL has its own CHyperLink too.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
Test out a prerelease build of my Hotfix Checker v2.0! (133K)
|
|
|
|
|
Hyperlink control
Jon Sagara
"Ninety percent of baseball is mental, the other half is physical." -- Yogi Bera
|
|
|
|
|
Lorenz Prem wrote:
Is there an easy way to do this
Easy way is to use ShellExecute to spawn the web site in IE
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I need an app who executes a form or another if the parameters are different. What's the code neccesary for it?
|
|
|
|
|
Look up CWinApp::ParseCommandLine on MSDN.
Michael
|
|
|
|
|
You might want to take a look at the CCommandLineInfo structure the appwizard creates for you in InitInstance() . You'll need to override ParseParam() to parse your own paremeters. Then set the necessary flag (perhaps an int ) to indicate which form of the program is running. You can then set up your app to behave differently.
Simon
Hey, it looks like you're writing a letter!
Sonork ID 100.10024
|
|
|
|
|
Thanks a lot guys
|
|
|
|
|
I use a image as CRichEditCtrl's background.
but when I input some words,the background was break by the character.
how to deal wiht it?
|
|
|
|