|
Hi all,
I would like to have a listctrl with multiline support. ie, each report (entry) can have mulitple lines.
how can i do that? any links ?
thanks in advance
hari
Hari Krishnan
|
|
|
|
|
|
I want to load the Accelerator that I have stored in a DLL in the EXE that link it. So I can, for example, press the Accelerator "F1" stored in the DLL and answer to the relative message in the EXE. Is it possible ?
Thank you for any answer.
Andrea
|
|
|
|
|
You can do *anything*. Some ideas on your particular problem include:
In your app init instance, load the dll(s) and extract the custom accelerator tables into a variable (or list, as appropriate).
Override the CWinApp::PreTranslateMessage(). In that handler, call TranslateAccelerator, passing the handle to your custom accelerator table. If you have more than one custom accelerator table, iterate through your list, calling TranslateAccelerator() until either your list members are exhausted or TranslateAccelerator returns non-zero. If TranslateAccelerator() returns non-zero, break and return TRUE from the PreTranslateMessage(). If your list is exhausted before PreTranslateMessage() returns a non-zero value, call the base (CWinApp::PreTranslateMessage()).
Example:
member: CPtrList m_oCustomAcceleratorList;<br />
<br />
BOOL CMyApp::InitInstance()<br />
{<br />
LoadDLLAcceleratorTables(&m_oCustomAcceleratorList);<br />
}<br />
<br />
BOOL CMyApp::PreTranslateMessage(MSG *pMsg)<br />
{<br />
HACCEL hAccel;<br />
POSITION pPos = m_oCustomAcceleratorList.GetHeadPosition();<br />
while (pPos)<br />
{<br />
hAccel = (HACCEL)m_oCustomAcceleratorList.GetNext(pPos);<br />
if (hAccel)<br />
{<br />
if (::TranslateAccelerator(m_pMainWnd->GetSafeHwnd(),hAccel,pMsg))<br />
return TRUE;<br />
}<br />
<br />
return CWinApp::PreTranslateMessage(pMsg);<br />
}
onwards and upwards...
|
|
|
|
|
Thank you very much basementman, I tried and it works. It's perfect for my problem.
Thanks a lot
Andrea
|
|
|
|
|
You can replace CFrameWnd::m_hAccelTable (AfxGetMainWnd ()) with whatever
accelerator you want.
So you can load the accelerator from a dll, then assign it as above.
Iain.
ps. Look up LoadAccelerator, AfxFindResource.
|
|
|
|
|
Hi,
I have a dialog based MFC application which has 2 timers with same interval (say 5 mins) accessing a single resource. A structure instance which is a member variable of the App class is being updated in one timer and the same structure instance is being used in another timer. ( Typically, the memory resource is being accessed for write in one timer callback and for read in another timer callback ). The code snippet something is like this,
CMyFrameDlg::TimerCallback1(...)
{
...
theApp.m_Struct.nVar1 = 10;
theApp.m_Struct.szVar2 = "test";
...
...
}
CMyFrameDlg::TimerCallback2(...)
{
...
...
localnVar = theApp.m_Struct.nVar1;
localszVar = theApp.m_Struct.szVar2;
...
}
The 2 timers get called simultaneously. Issue is, that the values dont get reflected properly in timer2 and while the struct is being accessed in timer2 it is being updated simulataneously in timer1. Both timers belong to the same Thread.
1.) I need to update the same resource in one timer and use it for some other purpose in the second timer. Is it possible ?
2.) I also have certain WM_.. messages posted from another thread to this thread on which a callback gets invoked. And this callback also accesses the same structure instance, but the values are not properly updated. Why is it so ?
Point is.. accessing the same resource ( memory) in multiple timers of the same thread. And also accessing same resource in multiple callbacks of the same thread (like user defined WM_message callbacks). Is there any restriction or way to do that ?
Anxiously Waiting for a reply
Cheers
Raja
|
|
|
|
|
Raja,
Why dont you consider using the Critical Section to avoid simultaneous access to the same resource... So, when the timers get called simultaneously, only one timer accesses the resource and the other waits till the critical section is released. If the application spans processes, you should be considering Mutex... Hope it helps you...
Harsha
----------------------------------
http://www.ece.arizona.edu/~hpg
----------------------------------
|
|
|
|
|
hi Harsha
Critical section can be used only when resource is getting accessed between 2 threads. What raja needs a way to share resource within same thread.
|
|
|
|
|
Thanks for your reply. I would like to know if critical sections can be
used to lock a section of code within the same thread. Critical Sections within same thread - possible ?
Cheers
Raja
|
|
|
|
|
I am sorry that I misunderstood the question... Anyway, I think critical sections can be used within the same thread. Although developed for multithreading, I suppose that critical sections do not understand which thread they should give access; they just know which resource to lock.
Harsha
----------------------------------
http://www.ece.arizona.edu/~hpg
----------------------------------
|
|
|
|
|
I have a slider control (from http://www.codeproject.com/editctrl/smartedit.asp) in a dialog, I want to receive notification in the dialog.
now, the HScroll and VScroll are handled in the slider class with ON_WM_HSCROLL_REFLECT and ON_WM_VSCROLL_REFLECT, which, as far as I understand, will override the message from the dialog ( ON_WM_VSCROLL and ON_WM_HSCROLL ).
Is there a way to let the message percolate to the dialog, as well as the control itself ?
I read the technical note TN062, and I'm not sure I understand correctly how this works.
Can I replace the WM_VSCROLL and WM_HSCROLL messages with WM_NOTIFY_EX ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Message reflection does not influence normal message behaviour. Your dialog can handle WM_HSCROLL and WM_VSCROLL with no problems at all. Just handle them exactly as usual (ON_WM_VSCROLL() etc.)
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I'm trying to set a breakpoint with a condition, but without success. What I need is a condition with a CString, however the following expression does not work:
<br />
m_name == "my name"<br />
Is this even possible, or am I doing someting wrong?
|
|
|
|
|
can you modify the Code ?
if so, put an ASSERT in the code where you want to check for the condition.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
I could do that, but I was wondering if it was possible to set the breakpoint condition this way.
|
|
|
|
|
you can set conditional breakpoints only on intrinsic comparisons.
The best you can do is bool b = m_name == "name"; and set a bp on the next line with the condition b==true
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi,
How can I call an Oracle Form or Report from a Visual c++ application ?
Thanks in advance
Felix
|
|
|
|
|
I'm including the dos.h header with this source.. I can't compile his. I have compiled this on my old computer without any problems... when i had windows 98... but now I have windows XP and I cant compile this. Im using Dev-C++.. can someone tell me how I can compile this simple program on windows XP? I'm just trying to call BIOS to change the VGA mode
int main( )
{
union REGS regs;
{
regs.h.ah = 0x00;
regs.h.al = 0x13; //enter VGA mode 13h
int86(0x10,& regs,& regs);
};
getch();
union REGS regs;
{
regs.h.ah = 0x00;
regs.h.al = 0x02; //back to text mode
int86(0x10,& regs,& regs);
};
return 0;
}
|
|
|
|
|
Sorry,
But you cannot communicate with the hardware directly under WindowsXP.
|
|
|
|
|
Yas, you're right. As long as he is using the same compiler version??? I don't think 'newer header files' will contain function prototypes to int86.
|
|
|
|
|
The REGS union is for old DOS programs. Newer 32-bit compilers do not support it. You'll need Visual C++ v1.52c for this.
|
|
|
|
|
Well the main reason I wanted to call BIOS was so I can control the X and Y position inside text mode. (0x02). Is there any other way I can do this without calling BIOS?
|
|
|
|
|
Try SetConsoleCursorPosition().
|
|
|
|
|
I am accessing MYSQL database in my program. I perform add , delete, edit, read and display operations on the database. The changes made should be reflected on other machine if same program is running . Pl tell me the way to achieve this.
|
|
|
|