|
Hello,
I've created a number of CEdit controls without using the Dialog or Class Wizard. How do I get notified of messages for events like EN_KILLFOCUS, and others, for these custom edit controls?
Thanks!
JennyP
|
|
|
|
|
Add ON_CONTROL entry to CYourDlg message map.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Hi
When I'm drawing an image with the GDI+ function Graphics::DrawImage(Image* image, int x, int y), the drawn image appears to be about 150% of the actual size of the image. The documentation clearly states that this version of DrawImage should render an image at the specified location and with the original size, but it's not. Anyone knows why? I'm using VC++ 6.0 on WinXP.
Thanks,
bf
|
|
|
|
|
is that 150% in pixels or physical measurement (inches, cm) ?
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
That would be in pixels.
When using DrawImage(Image* image, int x, int y, int width, int height) and specifying the actual width and height of the image (in pixels), all renders ok, so I guess the correct unit is used.
/bf
|
|
|
|
|
Hey Gang,
I am on the verge of panic today because I need to quickly develop a solution for a distributed analysis program. Thanks for taking the time to respond if you get a chance.
I have an exe that uses an XML DOM to represent the status of a system. The DOM is wrapped in an ATL interface that provides some convenience routines for manipulating the data in the DOM. For discussion I am going to refer to the ATL interface as the CurrentStateInterface.
I would like to share access across computers to an instance of the CurrentStateInterface. Ideally remote systems would be able to connect to the server application through an ATL interface and request the CurrentStateInterface. Once the interface is marshalled to the remote system, the remote system could make calls to the CurrentStateInterface which would manipulate the data in the DOM on the server.
I have read a few articles from the MSDN. One article suggested several possible solutions: Singleton objects, File monikers, CoMarshlInterface/CoUnMarshalInteface, Custom class objects, Custom monikers. I know some of these would work better than others. From what I have read, the file monikers look like an appropriate solution but I would look to someone with more experience for guidance.
I am hoping that someone has done something similar and can share his/her knowledge and experience. Any good suggested reading would be appreciated also.
Thanks very much for your time!
Hawk
|
|
|
|
|
Hi,
I did post a similar help before ... but I did not mention that I failed to open it within my Visual C++ 6.0 programming!
1) I open a MS Access97 table with 1 row & 2 filed numbers
2) In Visual C++ using Classwizard to add new class using CDaoRecordset (for that .mdb)
3) Run program to open that mdb to use ---> OK!
4) Now use MS Access97 open with Exclusive & add security password ("password") on it --> Save
5) Then even I tried programming to use codes in article TN054 ... or open with:
CDaoDatabase CDao;
CDao.Open("c:\\password97.mdb",true,false,"pwd= password");
---> I failed to open it!!!
Can someone help me with some codes (at RunTime) to open that mdb file? I appreciate very much for any suggestion & advice!
Thanks,
Anh Truong
|
|
|
|
|
where's the user id? uid?
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Does anybody know how to use the shell style animations such as those used for copying files etc. Can we borrow these from the shell for use in our own apps and if so how?
Thanks - Joel
|
|
|
|
|
There's the option of using SHFileOperation to move files (this function can show the dialog box that the shell shows), or there's also the option of creating your own dialog box. I'm not sure how mad Microsoft would get if you used their AVIs from the shell, but it's definately possible. If you use MFC, to try it out, put an animate control on one of your dialog boxes, map a member variable to it (CAnimateCtrl), and put this code in OnInitDialog (make sure you add a handler for OnInitDialog first):
<br />
HINSTANCE a_hRestore = AfxGetInstanceHandle();<br />
HINSTANCE a_hInstance = LoadLibrary( _T("Shell32.dll") );<br />
AfxSetResourceHandle( a_hInstance );<br />
c_oAnimate.Open( 160 );<br />
AfxSetResourceHandle( a_hRestore );<br />
FreeLibrary( a_hInstance );<br />
Here's a list of what the available AVI resources in Shell32.dll are, and what they show:
150 = File search flashlight.
151 = Find files magnifying glass (Small).
152 = Find computer (Small).
160 = Moving files.
161 = Moving files (different).
162 = Moving files to recycle bin.
163 = Emptying recycle bin.
164 = Deleting files.
165 = Some funky conversion?
166 = Find on the internet ?
Chris Richardson
|
|
|
|
|
Excellent, my last final windows programming question answered!
Thanks - Joel
|
|
|
|
|
Sorry if this is a simple question, but I can I get the handle to a window given the IDD resource value.
Here is what I want to do
CMainFrame (dlg1, dlg2, dlg3 created)
CMainFrame::ShowDialog(int nID) // Will display the dialog for IDD value
dlg1
OnOK() calls ShowDialog(IDD_DLG2) like this
((CMainFrame*)m_parent)->ShowDialog(IDD_DLG2)
I want something like:
CMainFrame::ShowDialog(int nID)
{
CWnd *pWnd;
pWnd = (CWnd *) GetDlgItem(nID); // Or 'GetWindowHandle(nID)'
if (pWnd->IsWindowVisible() )
pWnd->SetFocus();
else
pWnd->ShowWindow(SW_SHOW);
}
Is there a member function that can return a window handle give an IDD resource value?
Thank you.
Johnny
|
|
|
|
|
john john mackey wrote:
Is there a member function that can return a window handle give an IDD resource value?
No, this is not possible. A dialog resource (which is represented by an resource ID) is just a template for a dialog layout. It does not represent an actual dialog instance, which is represented by a hWnd.
Think of a dialog template as of a class in OOP. You can create an arbitrary number of dialog instances of the same dialog template. Therefore an one-to-one mapping between IDD and a hWnd could not even exist.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
|
|
|
Also Layout | Tab Order.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello all.
I've run in a problem when trying to get back the return value from a batch file called from a C program (Windows NT) . Here is the code :
/* C code */
#include <stdio.h>
#include <stdlib.h>
void main()
{
char* message[1024];
int ret = 0;
sprintf(message, "%s /C %s", getenv("COMSPEC"), "c:\\test.bat");
ret = system(message);
printf("%d\n", ret);
}
/* end C code*/
/* Batch file (c:\test.bat) */
exit 7777
/* End batch file*/
Now, I was expecting that "ret" has the value of 7777 but it seems that 0 it's all what it returns.
I was looking in the help of EXIT command and I found there that an exit code can be set :
EXIT [/B] [exitCode]
However this seems not to work.
I can return a value from a VB Script using Wscript.Quit 0 or from an Unix script but not from a batch file.
Any ideea regarding this issue ?
TIA.
|
|
|
|
|
|
the list control must know the string to put in the list control, if you need to put an integer or a double, etc. then you should format it first.
i show alot of integers in some of my lists, so i wrote a simple int to string function.. something like:
CString CCommonFunctions::toString(int nVal)
{
CString strTemp;
strTemp.Format("%i", nVal);
return strTemp;
} that way when you add your value to the list control you can just use
m_lstMyList.InsertItem(0, CCommonFunctions::toString(nMyInt));
also remember you can set a pointer to each object incase you need to associate each item with a custom object
CMyObject* myObj = new CMyObject("blah",1,20);
m_lstMyList.InsertItem(nPos, CCommonFunctions::toString(myObj->m_nX));
m_lstMyList.SetItemData(nPos, (DWORD) myObj); then later use GetItemData()
CMyObject* myObj = NULL;
int nPos = m_lstMyList.GetSelectionMark();
if (nPos != -1)
{
myObj = m_lstMyList.GetItemData(nPos);
}
-dz
|
|
|
|
|
didnt see you were asking about doubles specifically.. something like this:
CString strDouble;
strDouble.Format("%f", dDouble);
m_lstMyList.InsertItem(0, strDouble.Left(4)); <code>
-dz
|
|
|
|
|
Hi everyone,
Where can I find a good tutorial on creating ActiveX controls using C++. With and without MFC (though, I guess that would be like pulling your own teeth). Also, any book recommendations would be great too!
Thanks,
Pankaj
//=================================================
Q: How many C++ programmers does it take to change a light bulb?
A: You're still thinking procedurally. A properly designed light bulb object would inherit a change method from a generic light bulb class, so all you'd have to do is send a light-bulb-change message.
|
|
|
|
|
pankajdaga wrote:
Q: How many C++ programmers does it take to change a light bulb?
None! Its a hardware problem....
Err, sorry I can't answer yout real question.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
When you have a member variable of type _Recordset, and first create it you do a createinstance. Now if later in the code, you do it again, like
HRESULT hr = m_pRecordset.CreateInstance (__uuidof (Recordset));
then in essence have you overwritten the object, as in deleted the old recordset and created a new one addressed by the same variable pRecordset?
Basically I want to clear out the contents of the variable (the old recordset )and fill it with the results of my new search. I dont know if this is obvious, but I am none too sure.
Thanks,
ns
|
|
|
|
|
Hmmmm. I will try and be simple here. CreateInstance is like new(). What it does is what it says. It creates an instance of the recordset object.
If you wish to refresh the contents of the recordset with new data then simply close the recordset and open it with a new sql. There are probably other ways too. But do not call CreateInstance again. That is not the right way to do it.
Calling CreateInstance again is not equivalent to deleting.
You can read up on CreateInstance on MSDN or in any COM book.
|
|
|
|