|
ya, i tried that and i got a sample code that works. but the thing is that the code is way beyond my understanding. i have no idea how it works. besides, someone has tried the code and it works according to him. but i tried with several method and i did not get any positive result. was wondering if there is anyone mind to let me know how do i try the program. thanks a lot. by the way, i'm using Visual C++ 6.
thanks in advance
Rgds
thwan
|
|
|
|
|
Hi all,
Instead of creting the buttons if i drag and drog the buttons and make them ownerdraw on the dialog box and and try to sendthe messages to the background applications the sequence in which the keystroke generate shold be WM_KEYDOWN ->WM_CHAR->WM_KEYUP but its coming as WM_KEYDOWN->WM_KEYUP-> WM_CHAR for me for the following code can any one help me
void MyDialog::GenerateKeyStroke(UINT nVirtualKeyCode)
{
CMainWindow *pView= (CMainWindow*)GetParent();
LPARAM lParam;
lParam = MapVirtualKey(nVirtualKeyCode, 0) ;
//scan code are from 16-23 in lparam
lParam <<= 16;
//since repeat count is one
lParam++;
pView->PostMessage(WM_KEYDOWN , nVirtualKeyCode , lParam ) ;
lParam |= 0xC0000000;
Sleep(0);
pView->PostMessage(WM_KEYUP , nVirtualKeyCode , lParam ) ;
}
and I shold use only PostMessage can any one help adn if press Alt key System keyevents should generate for me what should i do for that
Request to all to continue this
|
|
|
|
|
Does anybody knows how to use dwLastChange field ?
I would like to calc how long my network interface is connected.
Tks
|
|
|
|
|
adriano_alvarez wrote:
Does anybody knows how to use dwLastChange field ?
I believe that member represents the amount of time, in centiseconds, that has elapsed since 1-January-1601.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have installed Platform SDK Windows Server 2003 (I work in VS 6.0 on WinXP) and I have a problem with CFileDialog.
This code
<br />
void CFileTestView::OnViewFile() <br />
{<br />
CFileDialog dlg(TRUE);<br />
dlg.DoModal();<br />
}<br />
worked just fine before defining _WIN32_WINNT, which I need to use different functions and constants. Now, when I define it
<br />
#ifndef _WIN32_WINNT<br />
#define _WIN32_WINNT 0x0501 // can be 0x0500 as well<br />
#endif<br />
my code just crashes in ~CFileDialog (when dlg does out of scope and is destroyed). Since m_ofn member of CFileDialog depends on this _WIN32_WINT:
<br />
typedef struct tagOFN { <br />
#if (_WIN32_WINNT >= 0x0500)<br />
void * pvReserved;<br />
DWORD dwReserved;<br />
DWORD FlagsEx;<br />
#endif // (_WIN32_WINNT >= 0x0500)<br />
} OPENFILENAME<br />
I rewrote the code this way:
<br />
void CFileTestView::OnViewFile() <br />
{<br />
CFileDialog dlg(TRUE);<br />
dlg.m_ofn.lStructSize = sizeof(OPENFILENAME);
<br />
#if (_WIN32_WINNT >= 0x0500)<br />
dlg.m_ofn.pvReserved = NULL;<br />
dlg.m_ofn.dwReserved = 0;<br />
dlg.m_ofn.FlagsEx = 0;<br />
#endif<br />
<br />
dlg.DoModal();
}<br />
but I still get a first-chance exception in FileTest.Exe (KERNEL32.dll) 0xC0000005: Access Violation (the usual stuff).
Now, I found out that if I declare dlg dinamically it doesn't crash:
<br />
void CFileTestView::OnViewFile() <br />
{<br />
CFileDialog* dlg = new CFileDialog*(TRUE);<br />
dlg.m_ofn.lStructSize = sizeof(OPENFILENAME);
<br />
#if (_WIN32_WINNT >= 0x0500)<br />
dlg.m_ofn.pvReserved = NULL;<br />
dlg.m_ofn.dwReserved = 0;<br />
dlg.m_ofn.FlagsEx = 0;<br />
#endif<br />
<br />
delete dlg;
}<br />
But If I derive CFileDialog to CMyFileDialog the program still crashes at delete:
<br />
void CFileTestView::OnViewFile() <br />
{<br />
CMyFileDialog* dlg = new CMyFileDialog*(TRUE);<br />
dlg.m_ofn.lStructSize = sizeof(OPENFILENAME);
<br />
#if (_WIN32_WINNT >= 0x0500)<br />
dlg.m_ofn.pvReserved = NULL;<br />
dlg.m_ofn.dwReserved = 0;<br />
dlg.m_ofn.FlagsEx = 0;<br />
#endif<br />
<br />
delete dlg;
}<br />
Any ideas? Thanks!
|
|
|
|
|
Does the problem persist if you use GetOpenFileName() instead?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Here's an idea...
Look at the beginning of the class definition for CFileDialog...
class CFileDialog : public CCommonDialog
{
DECLARE_DYNAMIC(CFileDialog)
public:
// Attributes
OPENFILENAME m_ofn; // open file parameter block
Whoa! There's an OPENFILENAME m_ofn member variable, and YOU DO NOT CONTROL IT'S SIZE!
You would have to rebuild your MFC DLL or rebuild the static MFC library to which you are linking, using the NEW size. Anyway, that is why you get the crash - you write to data that overwrites something else!
If you really need these new fields, you are going to have to 'swipe' the CFileDialog source code and make your own using the new data structure. Otherwise, just use OpenFileName as David Crow suggests.
|
|
|
|
|
First, my project is too large and I don't want to go and replace everything with OpenFileName().
Second, when I have to define _WIN32_WINNT to 0x0501 because I need it to use other functions that are define like
<br />
#if (_WIN32_WINNT >= 0x0500)<br />
#endif<br />
so OPENFILENAME will have the extra three data members. If Platform SDK provides me this (actually) new structure doesn't it also provide the necessary lib? Because of my settings it should try to link first to SDK libs and only after (if not found) to VS6.0 old libs.
|
|
|
|
|
does anyone know how to communicate with the Windows MIDI driver thru USB.???
|
|
|
|
|
Hello,
I am developing a DLL on eVC++ 4.0 in order to call some complex API functions through VS.NET 2003. But, VS.NET 2003 is generating an error at below;
An unhandled exception of type 'System.MissingMethodException' occurred in tester.exe
It is an WCE MFC AppWizard (dll) project. I cannot call even simple function. Sample code at below;
EXTERN_C
__declspec(dllexport)
int Tester(int a, int b)
{
return(a+b);
}
VS.NET code is a "Smart Device Application";
Imports System.Runtime.InteropServices
Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Declare Function Tester Lib "wtest.dll" (ByVal a As Integer, ByVal b As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim c As Integer
c = tester(1, 1)
End Sub
End Class
I can see the "Tester" function at dumpbin output. Also, I declared "Tester" in .def file at below;
; wtest.def : Declares the module parameters for the DLL.
LIBRARY "WTEST"
;DESCRIPTION 'WTEST Windows CE Dynamic Link Library'
EXPORTS
Tester
; Explicit exports can go here
What do you suggest about this problem?
Regards,
Orkun GEDiK
SAP R/3 Software & System Support Specialist
ASTRON
|
|
|
|
|
I was reading through an article by Jan
Visual C and C++ (General) Technical Articles
C++: Under the Hood
Jan Gray
March 1994
struct P {
int p1;
void pf(); // new
virtual void pvf(); // new
};
struct Q : P {
int q1;
void pf(); // overrides P::pf
void qf(); // new
void pvf(); // overrides P::pvf
virtual void qvf(); // new
};
Most C++ implementations will share or reuse an inherited base’s vfptr. Here Q did not receive an additional vfptr to address a table for its new virtual function qvf(). Instead, a qvf entry is appended to the end of P’s vftable layout. In this way, single inheritance remains inexpensive. Once an instance has a vfptr it doesn’t need another one. New derived classes can introduce yet more virtual functions, and their vftable entries are simply appended to the end of their one per-class vftable.
Does that mean Q will use P's vftable? If both P and Q share the same vftable?
I could not get exactly if some one can help me understand that properly?
|
|
|
|
|
I have a wrapper function generated by the ClassWizard from a type library which goes like this.
<br />
VARIANT ClassA::GetSession(const VARIANT& varItem)<br />
{<br />
VARIANT result;<br />
static BYTE parms[] = VTS_VARIANT;<br />
InvokeHelper(0x7dd, DISPATCH_METHOD, VT_VARIANT, (void*)&result, parms,<br />
&varItem);<br />
return result;<br />
}<br />
I result is an object of ClassB. How do I convert the VARIANT to an object of ClassB and call it's methods ?
|
|
|
|
|
Hi,
I'm trying to use the IShellFolder::GetDisplayNameOf method to get the filename in a drag drop application. But the function behaviour is dependent on the display settings of folders. When i choose to hide file extensions for known filetypes it creates problems and returns only the filename(no extension) and if i choose to display extensions for all files i get the filename with extension.
Can someone please tell me how to get rid of this behaviour i.e. get the filename with extension no matter what the folder displayt settings are.
Thanks in advance,
DS
|
|
|
|
|
Digvijay Singh Chauhan wrote:
I'm trying to use the IShellFolder::GetDisplayNameOf method to get the filename in a drag drop application. But the function behaviour is dependent on the display settings of folders. When i choose to hide file extensions for known filetypes it creates problems and returns only the filename(no extension) and if i choose to display extensions for all files i get the filename with extension.
I would think this to be intended behavior as that is what "display name" implies. If the shell has been configured to hide the file extension, shouldn't the interface respect the setting?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
How do I do to make CListCtrl cells bigger in height? I want them for e.g. to be 20 pixels.
_____________________________
...and justice for all
APe
|
|
|
|
|
You will need to make the control owner-draw and then you can use WM_MEASUREITEM to return the size with the appropriate height set.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
You mean I should overload the:
CWnd::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
function?
I've tried it but the function never seams to be called...
_____________________________
...and justice for all
APe
|
|
|
|
|
Have you changed the control to owner-draw?
Do you also realise that you will have to draw the items in the list control yourself too!?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Do I select the CListCtrl to be "an owner-draw control" by selecting that in the Properties window in the recource view? Is that "the thing to do" if I want to overrride functions like CListCtrl::DrawItem()?
_____________________________
...and justice for all
APe
|
|
|
|
|
Yes. If you look here at cp you will find quite a few owner-draw controls based on CListCtrl. They may be of some help if this is the first one that you are doing.
Good luck!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Tnx for help. I'll try to find some artickles about custom draw.
_____________________________
...and justice for all
APe
|
|
|
|
|
Hi, i have the following problem:
In my application (.NET) the user can plug in an USB-drive and the software starts with a download from this drive automatically. After downloading I will stop this USB-drive, so that the user can pull out the USB-drive immediately.
Please help me!
Thanks!
Rolf
|
|
|
|
|
Hi~~~~ guys
I really want to know how to make a table editor
I am tring to use RichEditCtrl in order to insert tables in editor program, but I really don't know about that. I have no idea about that!
I am goint to die!!!!!!!
please tell me your advise
have a nice day
cheers~~~~~~
^____________^
|
|
|
|
|
now,i'm writing mdi application.
my demo application using tab control.(not mdi tab)
tab control create with static control for display image.
When i start run demo,images is load.
next, i want to change another image while demo is running.
following code i using ....it is not ok..
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void CMyView::OnApply()
{
CMy_TabDlg *dlg = new CMy_TabDlg;
if (!dlg->Create(IDD_My_DLG, this))
return;
else
dlg->Load_samplephoto("image/none.bmp");
}
|
|
|
|
|
Hi,
I seem to have a problem with linking an MFC application.
I get the following errors:
error LNK2001: unresolved external symbol __imp__floor
error LNK2001: unresolved external symbol __imp__atof
error LNK2001: unresolved external symbol __imp__atof
Am i forgetting a library to link with or what could cause this problem?
Best regards,
Jens
|
|
|
|