|
Your problem is the application has told Windows that it is the only thing that should be allowed to use the drive. Windows obeys this, like it should.
Call your vender and see if there is soemthing you can do. The DeviceIoControl function call has nothing to do with it, it is the open call.
|
|
|
|
|
Call your vender and see if there is soemthing you can do. The DeviceIoControl function call has nothing to do with it, it is the open call.
I have tried to reach the Vendor but they have not responded, yet.
I tried to create an application that used the same DeviceIo calls that the comercial app and that locks the drive in the same way so it seems like the call with DeviceIoControl has something to do with it.
|
|
|
|
|
Hai,
I am working on win32 vc++.I have set of commands that i have to send it to serial port..how should i do that programatically..
thanks a lot..
|
|
|
|
|
You simply opens the port using CreateFile. The filename is the name of the serial port.
After that you can send and receive using ReafFile and WriteFile.
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
For additional info, please see Communication Functions in VC++ MSDN.
|
|
|
|
|
Hi, I am trying to make a program where the program asks me for a password and if the password is correc t it will tell me something important whereas if the password is incorrect it will tell me that the password is incorrect.
I have used MFC so far. Could any body help me read what is written in the Edit box to verify the password. Oh and yes I am completely new to this so please dumb it down a bit as well.
The code I have so far is:
void CpasswrdtestingDlg::OnOK()
{
// TODO: Add extra validation here
char *s1,*s2;// Declareing identifiers
(s1) = GetDlgItem( IDC_EDIT1 ); // Reading input from IDC_EDIT1 (NEEDS IMPROVEMENT)
s2 = "my password"; // Defines the password
// Outputs to give out to the user.
if (s1 == s2)
{
MessageBox ("Hello well done you got it right");
MessageBox ("Yey");
}
else
MessageBox ("It didnt work. Try again!!");
}
I would greatly thank full if anybody could help me with this. Thanks.
Buyer1
Buyer1
|
|
|
|
|
GetDlgItem() returns a CWnd*, not a char* .
CWnd::GetWindowText returns a CString; it might be usefull.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You can do it may like this:
CString strEnter; //Edit box string
CString strPassword = "My Password"; //Define the password
CEdit* pEdit = (CEdit*)GetDlgItem( IDC_EDIT1);
pEdit->GetWindowText( strEnter);//Get string you enter in the editbox
if(strEnter == strPassword)
{
MessageBox ("Hello well done you got it right");
MessageBox ("Yey");
}
else
{
MessageBox ("It didnt work. Try again!!");
}
|
|
|
|
|
rename also you control into a more significant name.
for example, IDC_PASSWORD_EDIT.
then, you can access like that :
CString strPassword;
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_PASSWORD_EDIT);
pEdit->GetWindowText(strPassword);
or faster if you like :
CString strPassword;
((CEdit*)GetDlgItem(IDC_PASSWORD_EDIT))->GetWindowText(strPassword);
TOXCCT >>> GEII power
|
|
|
|
|
Is there an easy way to center the title text "My window title"?
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "My window title"
END
|
|
|
|
|
The last time I read about something related to this, it involved drawing your own caption in the client area of the window. Yes it involved several lines of code but it did not seem all that bad. The code was well documented and laid out in an easy-to-read format.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
On one of my Dialogs I have a list of checkboxes, each one activates a different set of options, but how can you arrange for the Tab key to have the same effect as checking each Checkbox with the mouse.
grahamfff
|
|
|
|
|
The tab key should be used to navigate the controls on the dialog. Why are you wanting it to behave differently?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
The normal operation was to Tab and hit SpaceBar to select, its just the user wanted the Tab to do both the tabbing and selection.
i.e. if you arrange the first to be selected then could tab to the next and arrange for it to be selected.
I just did not know how to tab and select.
grahamfff
|
|
|
|
|
Hello,
Do you know a simple solution to extract headers from a jpg file (size, color depth, channels) ?
Regards,vince
|
|
|
|
|
If you know the JPG file format, it's easy. Go to www.wotsit.org and search for jpg. There are six examples.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
First you need the JPG file format
get it from www.wosit.com
|
|
|
|
|
Hi, i've tried and apoke with like a zillion people, but i did not succees in resolving this problem. I have to do in my app dome direct-draw drawing and on resize it flickers like hell. I've use "Clip children" options from dialog propertis (no ideea what this actually does) and the DDraw flickering stopped BUT the all buttons and stuff from my dialog "stays a little behind", giving a very ugly aspect. So, if i can't repaint the dialog correctly, i thought to force that windows option "show window contents while dragging" so that my app does not display anything on resize. Any ideea how i can do that?(or if you have an article on repainting a dialog app, that would be even more great).
Thanks alot guys ( and girls ?)
|
|
|
|
|
1. For starters, DO NOT EVER adjust a user preference because of a defect in YOUR software. That will surely piss off the end users.
2. You are not setting up or processing the clipping region/rectangle in the WM_PAINT correctly, for some reason. For example, if your window is SHRINKING, there should not be any drawing at all. IF your window is EXPANDING, then you should only need to repaint the areas that are newly exposed. Since a dialog does not normally resize, I am thinking that in the code where your dialog is being resized, if you are invalidating the ENTIRE client area, that is where your problem starts. You should only add the parts of the window that are newly exposed to an update region. Then, when the WM_PAINT comes in, your clipping rectangle should represent the area exposed, not the entire client area. Also, you can process the window background erasing. If you erase to the color of the dialog's background, instead of letting the default color (white, usually) come in, there will be less apparent flicker.
|
|
|
|
|
In my class definitions, I declared a public struct with multiple fields. I then declared both a public and private instance of it. The reason why I have the public instance is to be able to transport the manipulated variables or fields to those of the private ones via the Get and Set methods. Does this still follow the principle of encapsulation? Thanks!
|
|
|
|
|
you only need to have on private member variable of you field.
the Get/Set methods will be public, and will access the private data members.
typedef aStruct {
int a;
} aStruct_t;
class AClass
{
private:
aStruct_t myStruct;
public:
void SetValueInMyStruct(int i ){ myStruct.a = i;};
int GetValueInMyStruct(){ return myStruct.a; };
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
What if you have many private members/fields in the struct that you would like to access all outside of the class. Then there would have to be a set/get method for each one. Instead can I do the following? I declared a public instance of the struct to handle all kinds of data manipulation within the class and outside before transferring it to the private struct.
class AClass
{
public:
struct aStruct
{
int a;
int b;
int n;
}
aStruct a_struct;
private:
aStruct b_struct;
public:
void Set_StructValues(){b_struct = a_struct};
void Get_StructValues(){a_struct = b_struct);
-------------------------------------------------
void RandomFunction() //function of another class that uses a global
//pointer for the AClass
{
pAClass->a_struct.a = 1;
pAClass->a_struct.b = 1;
pAClass->Set_StructValues();
}
|
|
|
|
|
it depends what exactly you want to expose to "clients'. having a public struct that simply serves as variable holder is somewhat useless.
having 2 members that always need to be manually "synched" is a really bad idea ( if I understand what you describe ).
what happens if, for example, you decide to change the struct "aStruct" ( for whatever reasons ) ? You will need to change each external clients that access directly the public member struct. if you have Get/Set methods that hide the internal struct, the client might ne be needed to change, only the Get/Set method.
if the struct will be be used outside the class, make it external to your class.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How could I make it external given what I have above? My project includes a checklist that keeps track of all items that needs to be down. Each item, when clicked on, displays a child window that needs some type of user input. Once users have completed the form, a check mark appears on the checklist. The checklist class contains variables that indicate what has been completed. Hence the need for constantly changing the checkmark values. There are several items on the list that needs to updated in several classes. How can I make the struct external and will this work with the design I have in place? Thanks!
|
|
|
|
|
ok, if I understand correctly ...
- Each item in the check list is a structure ( containing the user input ); and is filled in their own child window ( so, a class, with the data )
You could have one big class ( structure ) containing all user inputs for all sub-forms; this class is created by the parent of the sub-forms, and a reference is passed to each sub-form. Each subform can fill (set) the values in that class; and the parent window can get the values, to update the UI; each sub-forms can keep local copies of the data for undo/reset, but those can be discreet values, no need to make a structure out of them.
for example ( very simplified, 2 forms, with one value per form ):
class MyData
{
private:
int m_iForm1Value;
int m_iForm2Value;
public:
void SetForm1Value( int i ) { m_iForm1Value = 1;};
int GetForm1Value( ) { return m_iForm1Value; };
void SetForm2Value( int i ) { m_iForm2Value = 1;};
int GetForm2Value( ) { return m_iForm2Value; };
bool IsForm1Complete(){ return m_iForm1Value != 0; };
bool IsForm2Complete(){ return m_iForm2Value != 0; };
};
class ParentFormDialog : public CDialog
{
private:
MyClass& m_Data;
void SetData( MyClass& data );
}
void ParentFormDialog::OnItem1Clicked()
{
Form1Dialog dlg;
dlg.SetData( &m_Data )
dlg.DoModal();
}
void Form1Dialog::OnOk()
{
int iValue = 1;
m_Data.SetForm1Value( iValue );
}
is this workable ? I think I understand what you want to achieve.
If you really want to have a structure for each sub-form data, make them class and implement a copy constructor, so you can copy them at will.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|