|
Ok. Thank you,
Also is related the project option
Basic RunTime Check,
"Default" in all the configurations
Now it works,
Thank you very much to all of you
|
|
|
|
|
Hi, I am creating one sample application that uses SQL Server and create one table having ID and Title (Unicode data).My problem is that i am using unicode data and when i open the table, "Question mark " is displayed in Title instead of unicode data. My workspace is unicode compiled and i am using nvarchar for lingual data as a variable. Here is my code
CDatabase db;
CString strLingual = L"";
m_edt_lingual.GetWindowTextW(strLingual);
CString strQuery;
try
{
if (db.Open(NULL, FALSE, FALSE, _T("Driver={SQL Native Client};Server=SHILPI_PHADNIS\\SQLEXPRESS;Database=TransTool;Uid=sp;Pwd=np;")))
{
db.ExecuteSQL(_T("CREATE TABLE WDCheckLingual (ID INT, Title NVARCHAR(50))"));
for (int i = 0; i < 10; i++)
{
strQuery.Format(_T("INSERT INTO WDCheckLingual (ID, Title) VALUES (%d, '%s')"),
i + 1, strLingual);
db.ExecuteSQL(strQuery);
}
}
}
catch (CException *e)
{
e->ReportError();
e->Delete();
}
Thanks in advance....
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Hello,
This is with regards to the query you asked me here[^]. Somehow, I am unable to add a reply there. So, I sent you an email. If you have not received, feel free to reply here and I shall assist you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi all,
i have created a modeless dialog box,but this Modeless dialog box not display in center of parent dialog box.
i want to show it in center of parent dialog box.
please tell me what can i do for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
toggle the item "Center" in the property window to "true".
|
|
|
|
|
i also try this, after using this modeless dialog box display in center of monitor.
if i move the parent dialog box in any side ,here the modeless diaolg box display in center of monitor not in center of parent dialog box.
here one mor problem,if i run two instance of my application than the modelss of both exe overlapped.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
There is trick for to put the chld window at the center of parent. You have to disable the parent windows before creating the child and after creating the child, enable the parent window back.
EnableWindow( FALSE );
ChildWndobj.Create( ChildWnd::IDD, this );
EnableWindow( TRUE );
|
|
|
|
|
Thanks its works.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
New to me too!
Thanks,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Iain Clarke wrote: New to me too!
Ya for me also. I just tried it when I saw the post.
|
|
|
|
|
Hi,
I have an application which uses ShellExecuteEx function to launch Outlook and attaching file.
************************************************************
shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS ;
shExecInfo.hwnd = NULL;
shExecInfo.lpVerb = "open";
shExecInfo.lpFile = "outlook";
shExecInfo.lpParameters = "C:\Test.doc";
shExecInfo.lpDirectory = NULL;
shExecInfo.nShow = SW_MAXIMIZE;
shExecInfo.hInstApp = NULL;
ShellExecuteEx(&shExecInfo);
************************************************************
I am using this functionality in my app ins such a way that once file attached i am proceeding with other functionality. But my problem is before file get attached my next step of application get executed.I want to get event or information that outlook is launched and file is get attached so that i can synchronize the functionality.
Please let me know how we can get the file attached event in outlook. Is it possible by using other API's like CreateProcess...etc....
Pls suggest.
THanks
SNI
|
|
|
|
|
To do this, I suspect you need to interface to Outlook using it's COM object model. I don't think ShellExecuteEx will cut it.
This article[^] shows how to talk to Outlook using Javascript. C++ is more involved - to get anywhere, you probably want to be using #import with Outlook's type library - use #import "progid:Outlook.Application" auto_search to get VC++ to generate classes for the Outlook object model.
Alternatively, this article[^] tells you how to do Office Automation with COM without using #import .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks for your reply. But I want to know the event by which I come to know whether file gets attached or not so i can move further for processing.
Any kind of idea will be helpful.
SNI
|
|
|
|
|
Yeah, it's a bit different than just launching outlook with a parameter when you use COM.
Here's some VBA that will start Outlook, create and send an e-mail.
Dim o As Object 'will be an Outlook.Application
Dim msg As Object 'will be a MailItem
Set o = CreateObject("Outlook.Application")
Set msg = o.CreateItem(0)
msg.Subject = "this is my subject"
msg.attachments.Add "path to the attachment"
msg.body = "my message"
msg.Recipients.Add "an e-mail address"
msg.send
You can replicate that relatively easily using the #import approach to interfacing with Outlook.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
C++ code for the VBA I posted - note that it's pretty much a direct translation...
#import "progid:Outlook.Application" auto_search
int main(int, char**)
{
try
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
Outlook::_ApplicationPtr ol(__uuidof(Outlook::Application));
Outlook::_MailItemPtr msg(ol->CreateItem(Outlook::olMailItem));
msg->Subject = "this is my subject";
msg->Attachments->Add("path to the attachment");
msg->Body = "my message";
msg->Recipients->Add("an e-mail address");
msg->Send();
}
catch (_com_error& e)
{
std::cerr << (char*)e.Description() << std::endl;
}
return 0;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Here is the code snippet.
class Super
{
public:
Super(){}
virtual void someMethod() {cout<<"in Super class"<<endl;}
};
class Sub : public Super
{
public:
Sub();
virtual void someMethod(){cout<<"in Sub class"<<endl;}
};
Sub mySub;
Super& ref =mySub;
ref.someMethod();
I don't really understand how the compiler works when it comes to the statement ref.someMethod(); . I guess the compiler first find someMethod() method in the Sub class. If doesn't find, then enter base class---Super class to find it.
above explanation is correct?
------------
If altering someMethod() in Sub class like this:
virtual void someMethod(int i){cout<<"in Sub class"<<endl;}<br />
what happens when the compiler runs ref.someMethod(); statement?
Obviously the output is "in Super class".
------------
If the someMethod() in Sub class is
virtual void someMethod(int i = 1){cout<<"in Sub class"<<endl} <br />
when the compiler runs ref.someMethod(); statement,what is the output?
In VS 2005,the output is "in Super class". I feel it is hard to understand,I believe the right result is "in Sub class".
Anyone could give me some idea,thanks in advance.
sharion
|
|
|
|
|
This feature is called run-time linking.
Based on the current type of the object the function call is resolved. So in first case the output is printed as "in Sub class" ie when function signatures in super and sub are same
When the function signatures are different, and the call is with a int parameter, it would look for a match which is defined in super and function is only available from the base part. So it calls the base class function
So obviously the compiler would say, I can not see it and I dont know what to call for and calls the base class exact match function for the remaining two cases.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
modified on Thursday, April 16, 2009 1:34 AM
|
|
|
|
|
Hi,
sharion wrote: If doesn't find, then enter base class---Super class to find it.
above explanation is correct?
- Here you are littlebit right, but virtual keyword doing magic here,
sharion wrote: when the compiler runs ref.someMethod();
Basically there is two type of binding
1. Run-time binding (or late binding)
- if same function define in parent class with same signature and it virtual, then compiler ignore it for run-time, and run time function will be called using VPTR and VPTABLE.
2. Compile-time binding (or erly binding)
- if above is not a case then compiler resolve binding at compile time only.
Parag Patel
Sr. Software Eng, Varaha Systems
|
|
|
|
|
sharion wrote: If the someMethod() in Sub class is
virtual void someMethod(int i = 1){cout<<"in Sub class"<<endl}
when the compiler runs ref.someMethod(); statement,what is the output?
In VS 2005,the output is "in Super class". I feel it is hard to understand,I believe the right result is "in Sub class".
No, the compiler is correct. In this case, there are two possible functions matching ref.someMethod() . The C++ Standard defines rules by which the compiler can decide which is the best match. These rules specify that a function with no parameters is a better match than a function with a parameter which has a default value. The fact that one of the methods is implemented in the derived class and one in the base class has no impact.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a problem of number formatting
I made a function to convert from number to string.
and I used "stringstream" class for converting.
like this
string strText;
stringstream ssBuf;
ssBuf<<55555;
ssBuf>>strText;
I expect "55555" as result. but the result is "55,555".
How do I remove thousand seperator "," in string?
Thanks.
cozyu
modified on Wednesday, April 15, 2009 10:25 PM
|
|
|
|
|
Your locale[^] is getting in the way.
You need to tell the stringstream to use a locale without number punctuation. The simplest way to do that is to just use the std::locale::classic() locale like this:
std::string strText;
std::stringstream ssBuf;
ssBuf.imbue(std::locale::classic());
ssBuf<<55555;
ssBuf>>strText;
However, this loses any other locale-specific properties, so you might just want to use the number punctuation bit of the classic locale, like this:
std::string strText;
std::stringstream ssBuf;
std::locale l;
l = l.combine<std::numpunct<char> >(std::locale::classic());
ssBuf.imbue(l);
ssBuf<<55555;
ssBuf>>strText;
The combine method call copies your global locale and replaces the copy's number punctuation facet with the classic locale's number punctuation facet.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Great reply, got my 5
Don't you consider writing an article for CP ? I think you could bring really valuable things
|
|
|
|
|
Cedric Moonen wrote: Great reply, got my 5
Cheers
Cedric Moonen wrote: Don't you consider writing an article for CP ?
There are a few things I've got that I've thought about writing up. Trouble is, I'm lazy It's a good attribute for a developer, as it means you're more likely to use someone else's code than write your own, but not so great for article writing!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: Your locale[^] is getting in the way.
Mine is set to use commas, yet I see 55555 when using the OP's code snippet.
"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
|
|
|
|
|
Yeah, so did I, but as locales are the only thing that affect stream output like that, it seems likely that locales were the issue. Anyway - I suspect your default C++ locale (which isn't necessarily the same as what your regional settings say!) is set to "C", a.k.a the 'classic' locale, like mine.
No, I don't know what sets the default C++ locale...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|