|
There is a RegQueryInfoKey function, but from the documentation I can't tell if it would give you what you want right off hand.
You could also try RegSaveKey. It saves the key info to a file and you could read the file afterward. Still not sure if it will save the path though.
"It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln
|
|
|
|
|
Hi,
Im having problem with the Rich Edit Control in MDI Applications (Derived from CFormView).
What happens is that the Application compiles and executes good, but when I open a new DialogBox window (with a RichEdit Control on it).The application fails to initialize the DialogBox.
"What" n "How" do i Fix this.
Plz Help.
bye
raheel
|
|
|
|
|
I think the problem is that you haven't registered the Rich Edit control.
When Windows creates a dialog box, it looks up the window class names in the dialog resource against the list of window classes registered for the process (registered with RegisterClass ). If it can't find one, it fails the dialog creation.
To get the Rich Edit control registered, call AfxInitRichEdit before creating this dialog. In your InitInstance override is probably a good place.
|
|
|
|
|
Hello ,
I have created Regualr dll file using shared MFC dll . In dll file I have
defined one function which is called by pascal/vb/vc++ program .The
program works fine as expected .The function displays the simple dialog box
with "OK" & "CANCEL" button .
But when I add the ActiveX control to DLL file , even without adding any member for activeX control , the program fails .I have just put the control box using control pallete in dialog editor as we add normal button .
What is the problem with ActiveX control . What are the settings I need
to do in order to use ActiveX control in the DLL project .
U can check the proplem by simply creating the project as below :
Steps which I followed are explained below :
1. Create DLL project using MFC AppWizard(DLL) , give the name as "sample" .
2. On the second step , keep all default setting .i.e "Regular DLL using shared MFC DLL"
Note the the option for "Automation" & "Winows Socket " are kept as unchecked .
2. Say ok , the application frame work is generated .
Now u can simply insert one dialog , with dialog ID as "IDD_DIALOG1" .
Don't add anything to the dialog .Using the claas wizard , add the class
for dialog , give the name as "Cmydialog" & base class class is "CDialog".
Don't add any control or variable to the dialog . Just leave it as it is .
Then in the sample.cpp file of ur project add the code as shown below.
include the file "mydialog.h" .
The logic in the calldlg function is self explainatory. It just shows message box
with the value passed by the calling function . Then it creates the the dialog &
just display it .
CSampleApp theApp;
BOOL CSampleApp::InitInstance()
{
AfxOleInitModule();
AfxEnableControlContainer();
return CWinApp::InitInstance();
}
void _stdcall calldlg(int x)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
int j;
j=x;
CString str;
str.Format("The value is %d ",j);
MessageBox(0,str,"title",0);
static Cmydialog pt;
static int flag= 0;
if(flag==0)
{
pt.Create(IDD_DIALOG1,AfxGetMainWnd());
flag=1;
}
pt.ShowWindow(SW_SHOW);
}
In the "sample.h" file add the declaration function for InitInstance() since we have
overriden it in the sample.cpp file .
Then add the "calldlg" i.e name of the function in the "sample.def" define file .
Compile it . The sample.dll file is created without any error .
Now just to check it , create client application using MFC . Create simple dialog
based application name "Testsample".
Add one button with id "IDC_TEST" & in the handler of that button call the
function "calldlg" in the dll file . The code is shown below :
void CTestsampleDlg::OnTest()
{
// TODO: Add your control notification handler code here
int p=2;
HMODULE hMod1;
PF pf1={0};
hMod1 = LoadLibrary("c:\\sample\\debug\\sample.dll");
pf1 = (PF)GetProcAddress(hMod1,"calldlg");
pf1(p);
}
just add the following in Testsampledlg.cpp in the very beginning only
typedef void (_stdcall * PF)(int);
Now compile the project & run it . It works without any problem .
Now just open the dll project , add the Microsoft Flex Grid Control with
"Project|add to the project|controls & componants" . Say insert ,
The Flex Grid control is added to the control pallete .The required classes
are also added to the project .
Now just put the flex grid control on ur dialog i.e IDD_DIALOG1 in our case .
Don't add any thing to the grid control as well as to the dialog .
Just compile it . It compiles without any error .
Now try to test it . U will see the Assertion error
What is the problem here with the activeX control now .
Please try it .
thanks & regards ,
Bhalchandra
|
|
|
|
|
I need help finishing up my project. I am really close I think.
I need to pass a binary tree in a treeNode::output to the List::insertNode to be inserted into a linked list. I've exhausted all ideas I can come up with and just dont see the light.
Thanks, here is the code I have.
<pre>#include <iostream>
#include <string>
#include "List.h"
using namespace std;
class treeNode
{
string name;
treeNode *smaller, *bigger;
friend class List;
public:
treeNode(string newName="", treeNode *newSmaller=NULL, treeNode *newBigger=NULL)
{
name=newName;
smaller=newSmaller;
bigger=newBigger;
}
void add(string newName)
{
if(newName<name)
{
if(smaller==NULL)
smaller=new treeNode(newName);
else
smaller->add(newName);
}
if(newName>name)
{
if(bigger==NULL)
bigger=new treeNode(newName);
else
bigger->add(newName);
}
}
void output(treeNode *name,List &l)
{
if(smaller!=NULL)
smaller->output(name,l);
l.insertNode(l);
if(bigger!=NULL)
bigger->output(name,l);
}
};
void main()
{
List l;
treeNode t;
string newName;
int howMany;
cin >> howMany;
for(int i=0; i<howMany; ++i)
{
cin >> newName;
t.add(newName);
//l.insertNode(treeNode *t);
}
//t.output(t);
//l.outputList(cout);
}</pre>
|
|
|
|
|
If List::insertNode takes a treeNode* parameter, you probably need to write
l.insertNode( &t ); It isn't clear to me what you're doing.
Normally I wouldn't recommend writing your own list and tree classes; the C++ standard library includes std::list and std::map or std::set for that.
|
|
|
|
|
But you have not indicated what specific problem you are having. I'm assuming you have single-stepped through each line of code using the debugger. If not, that would be a good place to start. Simply putting the code together, running the program, and noting the output, does not indicate whether your program is doing the right or wrong thing.
Are items added to the tree as expected? Can you traverse the tree in prefix, infix, and postfix order? Does changing your code to the following help:
void output(treeNode *name, List &l)
{
if (smaller != NULL)
output(smaller, l);
cout << name << endl;
if (bigger != NULL)
output(bigger, l);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Yes, that is very similar to what my teacher told me to do, if not identical. I was too much of a bonehead to not write it down though, thinking I could remember a couple simple parameters. I was wrong.
Sorry my thread was so vague. I will try to be more specific next time.
Thank you.
|
|
|
|
|
How do programs like window washer accomplish this. Do they go low level or hi level and just zero a file?
Wouldn't it make sense to just encrypt a file with a random password then delete it...?
Just cursious
I'm drinking triples, seeing double and acting single
|
|
|
|
|
I heard they overwrite it twice just to make sure any residual magnetism is destroyed.
|
|
|
|
|
|
JWood wrote:
residual magnetism is destroyed
Ahhh I wondered why they did that...Window washer does it like 30 times....I couldn't figure out why...
Interesting
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Indeed, the default behavior of the shred command on many Unix systems is to overwrite the file 25 times (!!) with random data, with the option of adding a final overwrite with zeros in an attempt to hide the fact that shred was even used.
Note, however, that most programs like shred can only work at the file level -- filesystems which do not guarantee that overwritten bytes are written to the same place on disk will likely leave residual chunks of the data file behind in unallocated space.
Of course, probably the best way to keep that data from being recovered would probably be to overwrite it with random data many time, zero it, delete it, cause a head crash on the occupied sectors, then melt the platters
- Mike
|
|
|
|
|
Michael Imamura wrote:
cause a head crash on the occupied sectors, then melt the platters
I don't think i'll be going that far...
I'm drinking triples, seeing double and acting single
|
|
|
|
|
i wanted to use switch instead of if-else so code:
CString buffer;
m_list.GetText(chosen,buffer); //select from listbox
switch(buffer)
{ case "Wet etch Al H3PO4":
recordset.Find(AFX_DAO_FIRST, "ID = 'AlW1'");
break;
case "Wet etch Al H3PO4/HF":
recordset.Find(AFX_DAO_FIRST, "ID = 'AlW2'");
break;
}
i have error: switch class cstring illegal and case expression not const, how do i correct this?
|
|
|
|
|
You can't use strings in a switch statement.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
|
hi..
Iam involved in the migration of an application developed on VisualAge C++ for windows to Visual Studio 6.0.
Could any one give some info of how it is to be approached ?
Any tips, tricks and pitfalls in achieving the objective ?
Any help is greatly appreciated.
Thanx
saleem
|
|
|
|
|
I have experience with Visual Age C++ (for OS/2) and with Visual Studio. Given that their approach to user interface code is so different, I would suggest re-engineering the UI code from scratch. I wouldn't try to 'port' the Visual Age stuff; it's just too different. Lower level logic could probably be ported, however.
Good luck.
Software Zen: delete this;
|
|
|
|
|
Hi,
In my MFC app, i create controls dynamically in a View.When i scroll the view there is lot of flickering in the screen.How to avoid this.Pls help
Thnks in advance and for all your HELP..Thnks again
ram
|
|
|
|
|
Try modifying the parent window style to include WS_CLIPCHILDREN. If the parent is a FormView, you can do this in the dialog editor; otherwise, override PreCreateWindow.
|
|
|
|
|
Hi all,
There are fonts that define characters in the C1 region, namely 0x80 thru 0x9F. (Windows CP1252 does have characters defined in C1 as well.) The problem is that these characters show up as empty square boxes when I use TextOut() and DrawText() to draw characters in these fonts. It appears that TextOut and DrawText filter out these characters. But Notepad2000 can display these characters as any other ASCII characters.
My question is: What character drawing function can display characters in the C1 region? Definitely there must be a way to display them. Otherwise, these characters don't show up in Notepad2000 either.
Thank you very much in advance for your help.
Hoc Ngo
hoc_ngo@yahoo.com
|
|
|
|
|
There are no problems displaying any character with TextOut() etc. that I am aware of. If you are seeing square boxes then you aren't using a font that includes the particular characters you want. You can use the Windows Character Map app to see the character sets for all installed fonts.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks for your respose.
FYI, the font does have these characters. It was designed for Windows 3.1 and all characters show up very well. I tested the same font with Notepad2000 and DrawText() and TextOut() on Win2000. Notepad can't display 4 chars at slots 0x80, 0x8e, 0x9e, and 0xb7. But DrawText(), TextOut(), and Character Map app do not show over 25 characters. So I just wonder what API to use, or what parameters to set, to display them. I am working on an application that needs to display all characters available in a font.
Thanks a lot for any insight.
Hoc
|
|
|
|
|
It sounds very strange that Character Map doesn't display these characters. I would focus on the font itself. Maybe it needs to be updated or recreated to work properly with W2K etc.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|