|
Hi,
I've Created an ActiveX container application by selecting container in the third step of the Wizard of to make an SDI Application. I'm able to Insert ActiveX Objects into the Application. they look real great. The problem is the window Messages like Left Mouse Button Click MouseMove etc.. are not being sent to the control as a result it just appears to be doing nothing but appear as images. is there any method that would enable the controls to recieve User Interface messages. Would be very thankful for helping out.
Thank You
|
|
|
|
|
Hi,
I've Created an ActiveX container application by selecting container in the third step of the Wizard of to make an SDI Application. I'm able to Insert ActiveX Objects into the Application. they look real great. The problem is the window Messages like Left Mouse Button Click MouseMove etc.. are not being sent to the control as a result it just appears to be doing nothing but appear as images. is there any method that would enable the controls to recieve User Interface messages. Would be very thankful for helping out.
Thank You
|
|
|
|
|
I have a drop-down list style combo box control in my program, with about 10 items in it. In XP, when it is dropped down, it shows all the items at once, like I want it to. But in 98, it only shows one item, with tiny up and down scrollbars to show the other items. Why does it do that? How can I make it show all the items at once?
Thanks!
|
|
|
|
|
Did you try extending the Combo Box's drop down length at design time.
By default it displays the tiny scrollbar as if there is only one item.
Cheers
Kannan
|
|
|
|
|
I can only make it wider in the dialog editor
|
|
|
|
|
Nevermind, I figured it out
|
|
|
|
|
This probably sounds like an ridiculously simple question but the DirectX 8.0 docs read like stereo intructions:
Once I have created an IDirect3DTexture8 texture in DirectX 8.0, how do I go about setting the color and alpha channel of individual pixels in that texture if I do not want to do so by loading an image file? (Actually, I am loading an image file but it's in a special format so I can't use any of the DirectX LoadImage functions.)
|
|
|
|
|
Calling SHGetSpecialFolderPath with CSIDL_WINDOWS and with CSIDL_DESKTOPDIRECTORY works fine in Windows XP, but in Windows 98 (SP1, IE6 SP1) CSIDL_WINDOWS doesn't work. Why is that? Is there a better way to get the user's Windows directory?
Thanks!
|
|
|
|
|
IGx89 wrote:
Calling SHGetSpecialFolderPath with CSIDL_WINDOWS and with CSIDL_DESKTOPDIRECTORY works fine in Windows XP, but in Windows 98 (SP1, IE6 SP1) CSIDL_WINDOWS doesn't work. Why is that?
According to MSDN, usage of CSIDL_WINDOWS requires Shell32.dll v5.0, i.e. at least Windows 2000 or Windows Millenium.
IGx89 wrote:
Is there a better way to get the user's Windows directory?
Try following:
TCHAR szWinDir[MAX_PATH+1] = {0};
GetEnvironmentVariable(_T("windir"), szWinDir, MAX_PATH);
Regards
Thomas
Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
IGx89 wrote:
Is there a better way to get the user's Windows directory?
How about the standard, old GetWindowsDirectory(...) function?
BTW: I do not believe that Win9x supported different/shared Windows/System directories a'la Win2K or later.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Hehe, that function just might work
|
|
|
|
|
hi everyone,
i'm working on a sdi application with window's explorer style(i.e. a
sdi application with a vertical splitter, dividing the windows into 2
panes, left and right pane).
i added a command, named 'add info', to the main menu and added the event handler to 'add info'. the coding of the event handler of 'add info'
command is done in left pane class. what 'add info' command do is creating a dialog that collects inputs from users then store these user inputs into a database. i modified the contructor of the dialog for 'add info' to accept a database object pointer(get past from the left pane class, when the dialog object is created).
when i start the program, if the windows focus in on left pane, i was able to run 'add info' command, display the dialog, save the inputs from the dialog and store in the database without any problem.
the problem occurs when my window focus is on right pane, if i run
'add info', i get error 'Unhandled exception at 0x005832ba in cat.exe: 0xC0000005: Access violation reading location 0x61636f4c.'
and the debugger points out that the program crashes at line 44 in objcore.cpp, within the function iskindof(.....)..
here is the function..
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const
{
ASSERT(this != NULL);
// it better be in valid memory, at least for CObject size
ASSERT(AfxIsValidAddress(this, sizeof(CObject)));
// simple SI case
CRuntimeClass* pClassThis = GetRuntimeClass();
return pClassThis->IsDerivedFrom(pClass);
}
i have no idea how to fix this bug. can someone help me out? thx in advance..
|
|
|
|
|
Did you try checking whether the db pointer you are passing to the dialog is valid.
Cheers
Kannan
|
|
|
|
|
how do you check whether the db pointer that i'm passing to the dialog is valid or not? because the dialog works perfectly when i had my window focus on the left pane, which is where the event handler was coded from, but when my window focus is on the right pane, my application crashed.. i too was suspecting about the db pointer, but i don't know how to fix it.. any suggestions? thx in advance.
|
|
|
|
|
When it is crashing in some windows function, you simply have to look into the call stack window to see from where it was called. Do this recursivly until you end into a class or function you know (either having written it or having used it in your code). Then look in there what went wrong .
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
How do I programmtically associate a file type with an application in Windows ?
|
|
|
|
|
Sameers wrote a article on just this. I can't say I've tried it, although I plan to when I find some (quiet alot of) spare time. Ahh... here it is...[^]
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
How to change the title on the dialog title bar in a window?
It was created in MFC with the title bar "abc" and I want to change it to "ghj". How can I do it?
|
|
|
|
|
pDlg->SetWindowText("ghj");
Pavel
Sonork 100.15206
|
|
|
|
|
Thank you.
|
|
|
|
|
Hello,
I am having problems with CAsyncSocket.. The errors occurs when I accept a socket.. I then have a function that resolves the IP address of the socket.. It then compairs the IP address with all of the IP address in an array.. then it returns a CString value of the IP address. After that I try to send data to the socket and I receive the following error..
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
(Press Retry to Debug the Application)
Here is my Resolve function.. (It's returning the correct value)..
CString CMainFrame::OnCompareAddress(CMySocket* pSocket)
{
CString strAddress,strListAddress, strDns, strName;
unsigned int iPort;
pSocket->GetPeerName(strAddress, iPort);
int iCount = m_array.GetSize();
while(iCount > 0)
{
ProcessMessages();
sfriend pFriend;
pFriend = m_array.GetAt(iCount-1);
CString strDns = pFriend.strDns;
hostent *pHost = gethostbyname(strDns);
if ( pHost != 0 )
{
sockaddr_in addr;
memset( &addr, 0, sizeof(addr) );
addr.sin_family = AF_INET;
memcpy( &addr.sin_addr, pHost->h_addr, pHost->h_length );
strListAddress = inet_ntoa(addr.sin_addr);
}
else
iCount = 0;
if(!strAddress.CompareNoCase(strListAddress))
{
strName = strDns;
iCount = 0;
}
else
iCount --;
}
if(!strName.IsEmpty())
return strName;
else
return strAddress;
}
My accept function..
void CMainFrame::OnAccept()
{
CMySocket* pSocket = new CMySocket();
pSocket->SetParent(this);
if (!m_sListen.Accept(*pSocket))
delete pSocket;
else
{
m_pConnectionList.AddTail(pSocket);
CString strName = OnCompareAddress(pSocket);
int nFound = 0;
int iCount = m_array.GetSize();
while(iCount > 0)
{
sfriend pFriend;
pFriend = m_array.GetAt(iCount-1);
CString strDns = pFriend.strDns;
if(!strDns.CompareNoCase(strName))
{
nFound = 1;
iCount = 0;
}
else
iCount --;
}
if(nFound = 0 )
{
CString strMessage;
strMessage = "(NOT_IN_LIST): ";
int iLen = strMessage.GetLength();
pSocket->Send((LPCSTR)strMessage,iLen);
OnCloseConnection(pSocket);
}
else
OnSendMyStatus(pSocket);
}
}
Any Ideas??
Rob
|
|
|
|
|
No. I recommend Winsock Win32 functions because you have more control in program design and implementation. You have no idea what the MFC Winsock class does.
Kuphryn
|
|
|
|
|
Im having a problem with timing a function. Here's how Im doing it now:
<br />
const double LOOP_MAX = 999;<br />
LARGE_INTEGER tCS,tCE;<br />
double Ang = 0,Res;<br />
<br />
QueryPerformanceCounter(&tCS);<br />
<br />
while (Ang++ < LOOP_MAX)<br />
CMObj::Function(Ang, Res);<br />
<br />
QueryPerformanceCounter(&tCE);<br />
<br />
tCS.QuadPart = tCE.QuadPart- tCS.QuadPart;<br />
QueryPerformanceFrequency(&tCE);<br />
<br />
double t = (double)tCS.QuadPart / tCE.QuadPart;<br />
<br />
double ps = LOOP_MAX / t;<br />
When I run the LOOP_MAX at 1 - 999, I get about 393,000 calls per second. But as I raise LOOP_MAX from there my calls per second drop (At 99,999 I get only 85,022). Is there something wrong with the way Im calculating this, or is there a reason why my call time would drop?
|
|
|
|
|
Try something like this
I just found this code in my mail, I havent used this code, but my friend told me it just worked fine for him.
<br />
#include < iostream ><br />
#include < windows.h ><br />
<br />
int DoTest()<br />
{<br />
int i;<br />
i = 42;<br />
return i*15;<br />
}<br />
<br />
int DummyTest()<br />
{<br />
return 0;<br />
}<br />
<br />
int main()<br />
{<br />
__int64 i64Start;<br />
__int64 i64End;<br />
__int64 i64Overhead;<br />
__int64 i64Frequency;<br />
__int64 i64Elapsed;<br />
<br />
const int iIterations = 100000;<br />
int result;<br />
<br />
QueryPerformanceCounter((LARGE_INTEGER*)&i64Start);<br />
for (int i = 0; i < iIterations; ++i)<br />
result = DummyTest();<br />
QueryPerformanceCounter((LARGE_INTEGER*)&i64End);<br />
<br />
i64Overhead = i64End - i64Start;<br />
<br />
QueryPerformanceCounter((LARGE_INTEGER*)&i64Start);<br />
for (i = 0; i < iIterations; ++i)<br />
result = DoTest();<br />
QueryPerformanceCounter((LARGE_INTEGER*)&i64End);<br />
<br />
i64Elapsed = (i64End - i64Start) - i64Overhead;<br />
<br />
QueryPerformanceFrequency((LARGE_INTEGER*)&i64Frequency);<br />
<br />
std::cout << "Time elapsed was: " << (double)i64Elapsed /<br />
(double)i64Frequency << " seconds" << std::endl;<br />
<br />
return 0;<br />
}<br />
Cheers
Kannan
|
|
|
|
|
I need a non-MFC method for converting the contents of a FILETIME struct into an integer (or double) representation that can be used for date/time comparisons.
Anybody got anything like that?
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|