|
Can you explain what do you need exactly?
|
|
|
|
|
A simple example:
I have a non-mode dialog ,and there are one Button, one ListBox in it.
Aim:
When the ListBox is empty the Button state is Disable, otherwise is Enable. And I want to use ON_UPDATE_COMMAND_UI message to do it.
Thanks very much!
|
|
|
|
|
|
I have developed a static library in Visual Studio 2005 using C and C++.
Now I would like it to be available in Visual Basic applications.
Currently I build a library file and include that and the header file of prototypes and build the solution.
I have included a typical libray function and my question is what do I need to do to allow access in VB.
Data Structure
static char EventText[][60] = {
"WAPI-000 Successfully Completed. ",
"WAPI-001 Initialisation Has Failed. ",
"WAPI-002 Failed to set the voltage level for coupling mode.",
...
...
etc
"WAPI-049 Failed to Write a Frame "};
}
Prototype in Header file
char * GetEventText429( UINT event_id);
}
The code of the function
char * GetEventText429( UINT event_id )
{
return &EventText[event_id][0];
}
e.g. Data structure, call in header file and code of function.
Many thanks,
Andy.
|
|
|
|
|
VB cannot use C/C++ static libraries. you'll need to put your code inside a DLL which exports functions using the stdcall convention.
|
|
|
|
|
Hi all,
The CFileDialog has on the bottom-right
corner a button labeled as "open".
How can i change the label into "save" ?
Thanx in advance,
Desmo16.
|
|
|
|
|
Did you read the documentation about the function ? (it's on MSDN).
If you read it, you would have seen that the first argument to the function is a boolean that specify if the file dialog is a load or save dialog box.
|
|
|
|
|
damn it !!!
i gave you the link to the constructor CFileDialog::CFileDialog()[^]... you didn't even bother reading it
msdn says :
bOpenFileDialog
Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.
|
|
|
|
|
toxcct wrote: damn it !!!
cool cool buddy.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: cool cool buddy
seriously... why answering to people when they don't listen to you...
|
|
|
|
|
I'm sorry you're right.
I didn't think it was so easy, I supposed i had to use
fd.m_pOFN->something to do it.
I found that immediately after the post.
Excuse me again.
|
|
|
|
|
nevermind, it's ok... but read the docs before asking too easy question
|
|
|
|
|
In additional you can use GetSaveFileName or GetOpenFileName
|
|
|
|
|
|
Bagaturia david wrote: char *Get(void)
{
static char a[]="thanks for any help!!!!";
char *p;
p = a;
return p;
}
p is a local variable even though it points to static buffer so it gets destroyed as soon as the function exists. This kind of coding should be avoided.
char *Get(void)
{
static char szString[] ="thanks for any help!!!!";
return szString;
} The same applies for long too.
|
|
|
|
|
The first case seems to work fine: it displays the entire string in our tests. What do you mean by "I get only one element and not array"?
In the second case the "<<" operator has a special meaning for your pointer: it display the address stored in the pointer, i.e. the address of your array. In order to display the pointed value (actually the first element from the array), try this:
cout << *p;
In order to display all of values, I think you need a loop.
-- modified at 6:14 Tuesday 14th November, 2006
|
|
|
|
|
Hi.
I want to do a small MFC application with a green background. I've seen in codeproject one quick way is to change OnEraseBkgnd() to:
BOOL CTestDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CBrush brTapete(RGB(0,127,0));
pDC=this->GetDC();
CBrush* pBrush = (CBrush*)pDC->SelectObject(&brTapete);
CRect Recto;
pDC->GetClipBox(Recto);
pDC->PatBlt(Recto.left,Recto.top,Recto.Width(),Recto.Height(),PATCOPY);
pDC->SelectObject(pBrush);
return TRUE;
}
It works, but now I have problems when putting controls like static texts on it. Their backgrounds are not the same as the application, so it's quite ugly. I've tried to change the control's property "Transparent" to True, but it doesn't work. I guess it's a problem in OnEraseBkgnd not redrawing the background behind the control, but I don't know what to do.
Someone can give me any orientation?
Thanks!
Rad.
|
|
|
|
|
You need to handle WM_CTLCOLOR message for static control.
Set background mode as TRANSPERANT there.
|
|
|
|
|
That was the problem! Now it works perfectly. Thanks, prasad_som!
Rad.
|
|
|
|
|
It seems you find your answer but also see another messages WM_CTLCOLOR* for EDIT,STATIC,LISTBOX and...
|
|
|
|
|
One file is created. I want to set the file attribute as "READ ONLY" from VC++ coding. when file is in read only mode it can not write data. Right click on created file and uncheck the "Read Only" property of file, this file property change information ahould get notified in VC++ code.
After unchecking the file property, it is able to write data into created file.
How to set file permission/property in VC++? and how to get the notification of file property into VC++?
Enjoy Life........
|
|
|
|
|
Poonamol wrote: One file is created. I want to set the file attribute as "READ ONLY" from VC++ coding
SetFileAttributes[^].
Poonamol wrote: and how to get the notification of file property into VC++?
Dont know about this, if it is possible .
|
|
|
|
|
Hello,
Thanks for instant reply,
But still I am facing problrms while removing read only attribute from file properties, this file is not opened for writting data.
Using GetFileAttribute[^] is it possible to get the notification of file properties whether it is read only / write?
Enjoy Life........
|
|
|
|
|
Poonamol wrote: But still I am facing problrms while removing read only attribute from file properties
Can you show code ? you are using.
I'm sure this should work,
SetFileAttributes("filename",FILE_ATTRIBUTE_NORMAL);
See this[^] example for more info.
Poonamol wrote: this file is not opened for writting data.
You need to mention this while opening file.
Poonamol wrote: Using GetFileAttribute[^] is it possible to get the notification of file properties whether it is read only / write?
You can determine whether this file is readonly by using this API.
BTW, why you are mentining 'notifications" here ? Notification are different from what you had mentioned here.
|
|
|
|
|
Can you show how do you use of SetFileAttribute
|
|
|
|