|
|
The PortOpen property looks promising. Have a look at the MFC VCTERM [^] example.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
I'm writing an MFC app that accesses a database. In the event of a DB user being denied access to a database object, I disable the relevant CView through an EnableWindow(FALSE) call. This works well. However, it has the potential to confuse users, who may wonder why the CView cannot be interacted with - is it a bug? Therefore, I'd like to have some obvious visual indication that the view cannot be interacted with, such as darkening it.
I'm not sure how a view can be darkened. I'd be willing to settle for some other obvious visual indication if it was easier to implement.
What approach is suggested?
Thanks in advance,
Sternocera
|
|
|
|
|
Sternocera wrote: I'd be willing to settle for some other obvious visual indication if it was easier to implement.
Are you wanting the view to be read-only (i.e., they can see records but can't edit them), or hidden?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
They can't see the records anyway - the view won't get populated. This is a database level permission. I already have the entire view non-responsive through my call to EnableWindow(FALSE) - from there, I just want a big visual cue that the view is not interactive, such as darkening the view.
Thanks
|
|
|
|
|
Sternocera wrote: ...I just want a big visual cue that the view is not interactive, such as darkening the view.
Well, you could always close the view, or create a separate view that simply contained the text, "You do not have permission..."
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
What does it mean to close a view? Replacing my view with another view would probably be very clunky with my existing design - I suspect I will have to do some drawing to the view.
I'd rather have something that is based on the view when permission is not denied, such as a darkened version of the same thing, or overlaying of a padlock icon. That way, the user may get familiar with the general layout of the program without necessarily being able to use it all.
Regards,
Sternocera
|
|
|
|
|
Here's how far I've got:
void CCommonBaseView::OnDraw(CDC* pDC)
{
if(view_is_disabled)
{
pDC->SetDCPenColor(RGB(0,0,0));
pDC->SetROP2(R2_MERGEPEN);
}
CFormView::OnDraw(pDC);
}
It ought to be possible for me to change the way that we draw to the device context through the CDC pointer, and make the CView appear different somehow - darkening it, or making it grayscale, or something else. I don't seem to be having much luck drawing to the device context after the base class implementation has been called; It just makes swathes of gray turn white.
What approach is suggested?
Regards,
Sternocera
|
|
|
|
|
Come on guys, I'd really like to get an answer to this! How can I draw onto a CScrollView from its OnDraw() to change its appearance significantly, such as making it grayscale or darkened?
Thanks,
Sternocera
|
|
|
|
|
Hi,
I have a multi threaded application which crashes at mfc42!CMapStringToString::GetAssocAt+14. Please see the DebugDiag tool output below.
Function Arg 1 Arg 2 Arg 3 Source
mfc42!CMapStringToString::GetAssocAt+14 07c59d50 086cf9a8 086cf9b4
mfc42!CMapStringToPtr::Lookup+12 07c59d50 086cf9d0 00000000
DataConverter+24d57 07c59d50 086cf9d0 00000000
DataConverter+1ce5e 07c59d50 086cfa04 73ed4343
DataConverter+436cb 105868f0 000003e4 07d13bb8
DataConverter+411ba 00425047 0000000b 00000000
DataConverter+40731 7c83e828 ffffffff 7c83e825
DataConverter+2d53e 0000000a 07d13bb8 00000000
DataConverter+539c0 0000000a 07d243f8 00000001
DataConverter+53887 00000000 07d13d30 07d13c68
mfc42!_AfxThreadEntry+119 0012f028 00000000 00000000
msvcrt!_endthreadex+a3 07d13c68 00000000 00000000
kernel32!BaseThreadStart+34 77bcb4bc 07d13c68 00000000
I'm just wondering at the two MFC42 calls on top. These two are from two different classes. If my understanding is not wrong, it has to call GetNextAssicAt() method in CMapStringToPtr class but calling the method in CMapStringToString class. Could somebody help me here?
This application runs for few hours and processes thousands of messages and crashes randomly. Every time it crashes, points at same memory address.
Event description for crash: Faulting application DataConverter.exe version 1.0.0.0, faulting module mfc42.dll version 6.6.8063.0, fault address ox000234e4
Thanks in advance.
Mallik
|
|
|
|
|
This sounds like a kind of race condition to me. Are you accessing this map from two separate threads ? If yes, make sure that you protect the map against concurrent access (with a critical section for instance). The problem might appear because two threads access the map at the same time, so the map is in an invalid state for one of the thread.
|
|
|
|
|
Hi Cédric Moonen,
Thank you for the response.
This Map is completely used by one thread but still I want to implement your suggestion and test it.
If you notice the MFC42.dll calls, there is something strange. I'm not understanding why CMapStringToString class's GetAssocAt() is called. It is supposed to call CMapStringToPtr class method.
thanks,
Mallik
|
|
|
|
|
HI All,
I have one ocx control developed in vc++/mfc and later the same code has been modified to use in automation server..now the problem is we need to keep separate clsid for the ocx control for server to avoid any conflict but its not changing the clsid even after changed in odl file..
Please show the right way to do this.
Thanks..
SoftwareDeveloper(.NET)
|
|
|
|
|
How do you know that (I'm assuming you've succesfully built the component with the new CLSID )?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Checked in the registry and found another folder with different name and same clsid..
using regedit.
Thanks..
SoftwareDeveloper(.NET)
|
|
|
|
|
Cannot you find the new CLSID in the registry?
Have you changed the interface name? Cannot you use the Oleview tool?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In ADO DB when should be a value converted to _bstr_t or _variant_t anf why ?
modified on Tuesday, May 19, 2009 12:51 PM
|
|
|
|
|
when: when you need a BSTR or a VARIANT
why: because you need a BSTR or a VARIANT
|
|
|
|
|
How do i insert a recordset where i take parameters from the user.
User enters his values in editboxes and when he hits "insert" button a query is fired
insert into table1 values (editboxvalue1, editboxvalue2 , editboxvalue3 , editboxvalue4 );
For this i can take values from editbox with the GetWindowText() method and store it in some variable .
but how should the query look like ,and should i use Connection::Execute() or Command::Execute() for this.
I have been using Connection::Execute( ) to Insert ,Update and Delete a recordset.
For queries with parameters which is a better choice ???
And how to form a insert query to insert values from user,into DB ???
|
|
|
|
|
vital_parsley2000 wrote: how should the query look like
INSERT INTO table1 VALUES (?,?,?,?)
vital_parsley2000 wrote: should i use Connection::Execute() or Command::Execute
Command::Execute, after appending a suitable number of parameters[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Could you help me with a link of this example where this insert is shown w/o using CADORecordBinding class.
|
|
|
|
|
Why - does Google not work for you? That's how I find these links.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
How can I load/insert an existing bitmap to the existing main application Toolbar? I do see where I can draw/Edit a new bitmap, but I have a bitmap that I downloaded from somewhere and I need to load that instead? How is this done usually?
Thanks
sft
|
|
|
|
|
One way is to simply copy it over the existing toolbar.bmp file. If it's already sized correctly, you're good to go.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks, I think I did that...I noticed the bitmap I am trying to copy has a different bit depth, like way off than the rest of the bitmaps for the toolbar...Would this be a reason to make it fail?
sft
|
|
|
|