|
Do these "invisible child dialogs" have the style "Visible" set to "True" in dialog editor?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi Code-o-mat,
I tried each possible combination for the visibility of the two dialogs, but no success.
|
|
|
|
|
Are you sure your child dialog got created (did for example its OnInitDialog run)? Did you try explicitly calling ShowWindow(SW_SHOW) on it after it was created? How did you embed it into your other child dialog? Is it maybe a drawing problem, try setting "Clip children" to TRUE on the dialog that contains the other child that seems invisible.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
The OnInitDialog was called properly.
CReportStack softwareStack;
softwareStack.Create(IDD_REPORT_STACK, this);
softwareStack.SetGroupTitle(_T("Software Stack"));
CRect rectChild;
softwareStack.GetWindowRect(&rectChild);
softwareStack.MoveWindow(12,66,
rectChild.right-rectChild.left,rectChild.bottom-rectChild.top);
softwareStack.ShowWindow(SW_SHOW);
This is the code where I create the dialog. Clip children also didn't have any effect.
|
|
|
|
|
HI all,
i m using rapi function to connect with windows based mobile first time when device is connected than i run my application than its establish connection successfully.
but in mid if i reconnect the device than after connection when i chek connection with my application than it shows this error message this is i get by CeRapiGetError "the device is not ready".
please tell me what can i do.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Did you check what is the last error using CeGetLastError What is the error when you use CeGetLastError?
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
When i m using CeRapiGetError() than its return "The Device is not Ready."
and when i m using CeGetLastError() than its return "The Operation was completed successfully"
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi all,
I am getting a value from a Edit box using this code
CString str1;
GetDlgItemText(IDC_LEFT,str1);
I want to convert this value to an integer, i know i can use atoi function to convert it but my problem is when the value in str is equivalent to 4312576705 atoi returns a value 2147483647.
i tried to convert it using long function but the result remains same.
now what should i do??
Can anybody help me in this.
Thanks in advance
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Why trying for just atoi?
integer( -2147483648 to +2147483647) can adjust a limit of at a max.
so use _int64( -9223372036854775808 to +9223372036854775808 )
__int64 nData = _atoi64( const char* );
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanku it resolved my problem..
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi All,
Can anybody tell me how to retreive hard disk interface type without using WMI classes in MFC.WMI classes is not working with all PCs.
Thanks
|
|
|
|
|
Abinash Mohanty wrote: Can anybody tell me how to retreive hard disk interface type without using WMI classes in MFC
Hi Abinash,
The MFC classes[^] are a very small subset of the Microsoft Windows API. The answer to your question is that MFC does not have any methods of determining a drive volume bus type.
But you can use the IOCTL_STORAGE_QUERY_PROPERTY[^] control code to obtain the STORAGE_BUS_TYPE[^]. Here is an example:
#include <winioctl.h>
#define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
STORAGE_BUS_TYPE GetDriveBusType(DWORD dwDrive)
{
STORAGE_BUS_TYPE sbt = BusTypeUnknown;
HANDLE hDrive;
TCHAR szDrive[MAX_PATH];
_stprintf(szDrive,_T("\\\\.\\PhysicalDrive%d"), dwDrive);
hDrive = CreateFile(szDrive,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,NULL, OPEN_EXISTING, 0, NULL);
if(INVALID_HANDLE_VALUE != hDrive)
{
DWORD dwSizeBytes;
STORAGE_PROPERTY_QUERY q;
ZeroMemory(&q,sizeof(STORAGE_PROPERTY_QUERY));
PBYTE pBuf = (PBYTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(STORAGE_DESCRIPTOR_HEADER));
if(NULL != pBuf)
{
if(TRUE == DeviceIoControl(hDrive,IOCTL_STORAGE_QUERY_PROPERTY,&q,sizeof(STORAGE_PROPERTY_QUERY),pBuf,sizeof(STORAGE_DESCRIPTOR_HEADER),&dwSizeBytes, NULL))
{
STORAGE_DESCRIPTOR_HEADER *pHeader = (STORAGE_DESCRIPTOR_HEADER *)pBuf;
dwSizeBytes = pHeader->Size;
pBuf = (PBYTE)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,pBuf,dwSizeBytes);
if(NULL != pBuf)
{
if(TRUE == DeviceIoControl(hDrive,IOCTL_STORAGE_QUERY_PROPERTY,&q,sizeof(STORAGE_PROPERTY_QUERY),pBuf,dwSizeBytes,&dwSizeBytes, NULL))
{
STORAGE_DEVICE_DESCRIPTOR * pDesc = (STORAGE_DEVICE_DESCRIPTOR *)pBuf;
sbt = pDesc->BusType;
}
}
}
HeapFree(GetProcessHeap(), 0, (LPVOID)pBuf);
}
}
return sbt;
}
Best Wishes,
-David Delaune
|
|
|
|
|
I am currently having problems with my ADO connection string. I have searched all over the internet for a solution to this problem but I have yet to find a solution. Can someone help me with the proper configuration for a SQL OLEDB connection with a windows authentication? Included is my C++ code file. I cannot include my SQL Server signon but can send a printscreen via e-mail attachment.
// ConnectionString.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
// ConnectionStringSampleCpp.cpp
// compile with: /EHsc
//#import "msado15.dll" no_namespace rename("EOF", "EndOfFile")
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "EOFile")
// Function declarations
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
void ConnectionStringX();
_bstr_t GetState(int intState);
void PrintProviderError(_ConnectionPtr pConnection);
void PrintComError(_com_error &e);
int main() {
if (FAILED(::CoInitialize(NULL)))
return 0;
ConnectionStringX();
::CoUninitialize();
}
void ConnectionStringX() {
// Define Connection object pointers. Initialize pointers on define. These are in the ADODB:: namespace
_ConnectionPtr pConnection1 = NULL;
_ConnectionPtr pConnection2 = NULL;
_ConnectionPtr pConnection3 = NULL;
_ConnectionPtr pConnection4 = NULL;
// Define Other Variables
HRESULT hr = S_OK;
try {
// Open a connection using OLE DB syntax.
TESTHR(pConnection1.CreateInstance(__uuidof(Connection)));
//pConnection1->ConnectionString = "Provider='sqloledb';Data Source='(local)';"
// "Initial Catalog='DSNPubs';Integrated Security='SSPI';";
//pConnection1->ConnectionString = "Provider='sqloledb';Server='PCD-LT-MCERTINI\\SQLEXPRESS';"
// "AttachDbFilename='C:\\SQL Server 2000 Sample Databases\\NORTHWND.mdf';Initial Catalog='northwind';Trusted_Connection=Yes;";
pConnection1->ConnectionString = "Provider='SQLOLEDB.1';Persist Security Info='True';User ID='mcertini';Initial Catalog='northwind';Data Source='PCD-LT-MCERTINI\\SQLEXPRESS';";
//pConnection1->ConnectionString = "Provider='SQLNCLI10';Data Source='NORTHWND.mdf';";
pConnection1->ConnectionTimeout = 30;
pConnection1->Open("", "", "",adConnectUnspecified);
printf("cnn1 state: %s\n", (LPCTSTR)GetState(pConnection1->State));
// Open a connection using a DSN and ODBC tags.
// It is assumed that you have create DSN 'DataPubs' with a user name as
// 'MyUserId' and password as 'MyPassword'.
//TESTHR(pConnection2.CreateInstance(__uuidof(Connection)));
//pConnection2->ConnectionString = "DSN=DataPubs;UID=MyUserId;PWD=MyPassword;";
//pConnection2->Open("", "", "", adConnectUnspecified);
//printf("cnn2 state: %s\n", (LPCTSTR)GetState(pConnection2->State));
// Open a connection using a DSN and OLE DB tags.
//TESTHR(pConnection3.CreateInstance(__uuidof(Connection)));
//pConnection3->ConnectionString = "Data Source=DataPubs;";
//pConnection3->Open("", "", "", adConnectUnspecified);
//printf("cnn3 state: %s\n", (LPCTSTR)GetState(pConnection3->State));
// Open a connection using a DSN and individual arguments instead of a connection string.
// It is assumed that you have create DSN 'DataPubs' with a user name as
// 'MyUserId' and password as 'MyPassword'.
//TESTHR(pConnection4.CreateInstance(__uuidof(Connection)));
//pConnection4->Open("DataPubs", "MyUserId", "MyPassword", adConnectUnspecified);
//printf("cnn4 state: %s\n", (LPCTSTR)GetState(pConnection4->State));
}
catch(_com_error &e) {
// Notify user of any errors. Pass a connection pointer accessed from the Connection.
PrintProviderError(pConnection1);
if (pConnection2)
PrintProviderError(pConnection2);
if (pConnection3)
PrintProviderError(pConnection3);
if (pConnection4)
PrintProviderError(pConnection4);
PrintComError(e);
}
// Cleanup objects before exit.
if (pConnection1)
if (pConnection1->State == adStateOpen)
pConnection1->Close();
if (pConnection2)
if (pConnection2->State == adStateOpen)
pConnection2->Close();
if (pConnection3)
if (pConnection3->State == adStateOpen)
pConnection3->Close();
if (pConnection4)
if (pConnection4->State == adStateOpen)
pConnection4->Close();
}
_bstr_t GetState(int intState) {
_bstr_t strState;
switch(intState) {
case adStateClosed:
strState = "adStateClosed";
break;
case adStateOpen:
strState = "adStateOpen";
break;
default:
;
}
return strState;
}
void PrintProviderError(_ConnectionPtr pConnection) {
// Print Provider Errors from Connection object.
// pErr is a record object in the Connection's Error collection.
ErrorPtr pErr = NULL;
if ( (pConnection->Errors->Count) > 0) {
long nCount = pConnection->Errors->Count;
// Collection ranges from 0 to nCount -1.
for ( long i = 0 ; i < nCount ; i++ ) {
pErr = pConnection->Errors->GetItem(i);
printf("Error number: %x\t%s\n", pErr->Number, (LPCSTR)pErr->Description);
}
}
}
void PrintComError(_com_error &e) {
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
// Print Com errors.
printf("Error\n");
printf("\tCode = %08lx\n", e.Error());
printf("\tCode meaning = %s\n", e.ErrorMessage());
printf("\tSource = %s\n", (LPCSTR) bstrSource);
printf("\tDescription = %s\n", (LPCSTR) bstrDescription);
}
|
|
|
|
|
Could you post the error/problem that you are getting/facing while trying to establish the connection?
-Rane
|
|
|
|
|
The following is the error message I am receiving:
Error number: 80040e4d Login failed for user 'mcertini'.
Error
Code = 80040e4d
Code meaning = I
Source = Microsoft OLE DB Provider for SQL Server
|
|
|
|
|
This error message is self-explanatory. Check whether your DSN is setup correctly. Any incorrect DSN(UserID/Pwd) will lead to this error.In addition Pl check if you have right level of access to the database.
-Rane
|
|
|
|
|
Hi everybody,
I have a class called STSource ("ST" is my system prefix) and it represent a program source. i have too, more two classes called STCobol and STHtml. STSource need to execute a function that separate informations using a very specific way that have a same name inside STCobol and STHtml. I don´t like to use conditions sintaxes to check file extension and to decide which object will be instanciated (For me oCobol ou oHtml). How can i instanciated a pointer or something to this.
I need
STSource oSource
if cobol
oLanguage = STCobol
else
if HTML
oLanguage = STHtml
oLanguage.DoSomething()
and not
STSource oSource
if cobol
STCobol oCobol
else
if HTML
STHtml oHtml
if cobol
oCobol.DoSomething()
else
if HTML
oHtml.DoSomething()
Thanks for read my questions
Sorry by poor english, i´m Brazilian
|
|
|
|
|
Have STCobol and STHtml be derived classes from a base class with exactly one pure virtual function named "DoSomething()". Then you can declare oLanguage as type "baseclass" and oLanguage.DoSomething() or (oLanguage->DoSomething() depending on the declaration) will invoke the proper function.
|
|
|
|
|
Humm
If i understood the code will be like this
class STSource
{
public:
virtual void DoSomething()=0; //pure virtual Function Definition
};
class STCobol:public STSource
{
public:
void DoSomething()
{
cout<<"Hi...";
}
};
class STHtml:public STSource
{
public:
void DoSomething()
{
cout<<"Bye...";
}
};
class AnyClass1:
{
STSource* pArray[2];
STCobol oCobol;
STHtml oHtml;
pArray[0]=&oCobol;
pArray[1]=&oHtml;
if cobol
pAarray[0]->DoSomething();
else
if html
pArray[1]->DoSomething();
}
class AnyClass2:
{
STSource* pSource;
if cobol {
STCobol oCobol;
pSource=&oCobol;
}
else
if html {
STHtml oHtml;
pSource=&oHtml;
}
}
pLanguage->DoSomething();
One more question: When i instanciated a STCobol or STHtml, STSource wiil be instanciated automactly
are the above things correct or am i keeping crazy ?
|
|
|
|
|
as i see have done it fine.
You can do things better like:
if cobol
pAarray[0]->DoSomething();
else
if html
pArray[1]->DoSomething();
}
if the STSource has a function GetClassType() with enums. Or -> CObject and IsKindOf()
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
For the last bit of code, I'd use something like this instead:
class AnyClass2:
{
STSource* pSource;
if cobol {
pSource=new STCobol;
}
else
if html {
pSource= new STHtml;
}
}
pSource->DoSomething();
Just remember to a) delete pSource after you're done with it, b) add a virtual destructor to STCobol and STHtml.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi.
I'm using Visual Studio 2005. I want to create HTML Help from XML comment using Sandcastle Help File Builder. I'm using it for C# programs and it's working very well. But, for my C++ project, when i generated the XML file, only the classes are documented (nothing else) and all classes are described as structure.
How can i solve this problems ?
Thanks.
Noel
|
|
|
|
|
I've been working on the same problem. I looked at Doxygen, but I don't like the output and really want our C++ API docs to be tightly integrated into the help web pages generated by Sandcastle for our C# API documentation.
I read somewhere that if can create a MAML file, you can do this, but I haven't been able to find out more concrete information.
|
|
|
|
|
I'll take a quick look at the MAML but I'm not sure that is the true solution. I think part of the problem is when generating the xml file in Visual Studio 2005. Only the methods are included in XML files. I do not understand yet why SHFB detects classes as structures.
|
|
|
|
|
Hello,
I have a more theoretical question.
If you have a class Apple
class Apple { ... }
and then you have a map of them:
std::map<int, Apple> apple_map;
Populate it with some random crap, then somewhere try and reference a value that is NOT in the map:
...
Apple& apple_ref = apple_map [key_not_in_map];
...
what is returned? can I NULL check it? My understanding is that it is the default_type for the object being referenced (Apple in this case). What is this? and how do I change/know it for developer defined classes?
|
|
|
|
|