|
|
What does "Changing language" mean?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
In ControlPanel->Regional and Language Options->Advanced Tab-> there is an option "Language for non-Unicode programs", I want to change it programatically, is there any API for that???
|
|
|
|
|
I'm not sure, but see if _tsetlocale()[^] helps (I do not have VS on this machine, so I cannot test it either).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thank you Rajesh... this helps me I guess, will test it
|
|
|
|
|
What you are describing is a System Locale and it cannot be changed programatically.
|
|
|
|
|
Hello, I have to add data to a vector in sorted order.
For example:
3,7,3,4
must be:
1)3
2)3,7
3)3,3,7
4)3,3,4,7
What is the most quick way to do this? Or maybe other data stuctures like Map would be better for this task?
|
|
|
|
|
You may use a multiset [^].
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]
|
|
|
|
|
alikalik wrote: Or maybe other data stuctures like Map would be better for this task?
std::set[^] is a sorted associative container.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hm... But is it possible to access the element at the specified index in multiset?
|
|
|
|
|
Depends on the usage patterns. If the number of lookups is significantly higher than the number of inserts, then I'd just use a sorted vector (as my experiences indicate that a binary search on a sorted vector is significantly faster than use of STL's associative containers in C++). If inserts are more significant than that, use a std::multiset as suggested elsewhere.
If using a sorted vector, it helps to delay the sort operation until required, using something like below, rather than blindly sorting on every insert.
template<class Type>
class SortedVector
{
public:
SortedVector() sorted_(true) {}
void insert(Type const& value)
{
sorted_ = false;
data_.push_back(value);
}
typename std::vector<Type>::const_iterator find(Type const& value) const
{
if (!sorted_)
{
std::sort(data_.begin(), data_.end());
sorted_ = true;
}
std::vector<Type>::const_iterator found =
std::lower_bound(data_.begin(), data_.end(), value);
return (*found == value)?found:data_.end();
}
private:
mutable bool sorted_;
mutable std::vector<Type> data_;
};
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
im trying to override create function for modelessDialog Box.. as follows..
CTestDlgDlg (application name)
BOOL CTestDlgDlg::Create(UINT nID, CWnd* pParent)
{
CDialogTemplate dlt;
int nResult;
// load dialog template
if (!dlt.Load(MAKEINTRESOURCE(CTestDlgDlg::IDD))) return FALSE;
// get pointer to the modified dialog template
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);
LPDLGTEMPLATE pDlgTemplate = (LPDLGTEMPLATE)pdata;
//pDlgTemplate->style |= DS_SETFONT;
// set your own font, for example "Arial", 10 pts.
dlt.SetFont(L"Arial", 12);
// let MFC know that you are using your own template
m_lpszTemplateName = NULL;
//InitModalIndirect(pdata);
// display dialog box
//nResult = CDialog::DoModal();
// unlock memory object
// CDialog::Create(nID,pParent);
CDialog::CreateDlgIndirect(pDlgTemplate, pParent, AfxGetInstanceHandle());
GlobalUnlock(dlt.m_hTemplate);
}
But it behaves same as modal Dialog box Instead of modeless ..
Please try to help..
|
|
|
|
|
Is there a CDialog::CreateDlgIndirect?
There sure is a CDialog::CreateDialogIndirect.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
CDialog::CreateDlgIndirect is present it"s a private function in dlgcore.cpp ..it"s a CWND class member function....
|
|
|
|
|
But it's not virtual, so if CreateDlgIndirect is called using an instance pointer typed as CDialog (which is highly likely, as CDialog is the only class with visibility of that method), it'll always call the CDialog version of the method.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
This is from MSDN
"Quote"
FIX: The CDialog::Create() function returns an incorrect value when a dialog box is created in Visual C++
View products that this article applies to.
This article was previously published under Q193099
"Unquote"
Sample:
// Create a modeless dialog box. In this example, m_pModeless is a
// member variable of type CModeless where CModeless is a CDialog-
// derived class. IDD_MODELESS is the ID number of a dialog-box template
// resource.
m_pModeless = new CModeless;
if (m_pModeless->Create(IDD_MODELESS, this) && ::IsWindow(m_pModeless->m_hWnd))
{
// ... succeeded in dialog-box creation.
}
else
{
// ... failed in dialog-box creation.
}
Once again from MSDN.
For me personally. I have always created the dialog box first, tested it as a modal dialog and then made it modeless by creating it as follows:
LogonDlg* pDlg = new LogonDlg;
// create it if necessary
LogonDlg * pApp = (LogonDlg*)AfxGetApp()->m_pMainWnd;
if (pApp->m_hWnd == NULL && !pApp->Create(LogonDlg::IDD))
{
CTraceLog::TraceMsg( "InitInstance failed to create LogonDlg" );
return FALSE;
}
pApp->SetVisibility( SW_HIDE );
|
|
|
|
|
hi!
i have made a dialog based(windowed) mfc activex control ,i want to make it transparent and again retain the previous state according to user choice.kindly help me.
thanx in advance
|
|
|
|
|
What do you mean make it transparent?
|
|
|
|
|
To make it transparent means to hide the dialog when required and unhide it(show it back)as required.
|
|
|
|
|
The way to do this is to use:
::ShowWindow( SW_HIDE or SW_SHOW )
Usually one would add a method to the control as:
BOOL LogonDlg::SetVisibility( int nCmd )
{
BOOL bRet = ShowWindow( nCmd );
if( nCmd == SW_SHOW )
SetForegroundWindow();
return bRet;
}
|
|
|
|
|
::ShowWindow( SW_HIDE or SW_SHOW )
hides and show the control not the dialog.
please tell me how to do it for a dialog.
if u have done it by ::ShowWindow( SW_HIDE or SW_SHOW ) then kindly tell the detailed code of it.
|
|
|
|
|
The ShowWindow API can be used inside any dialog. There is no more to it than just that. It is usually made a part of a method which also includes the SetForegroundWindow but that is all. Experiment with it. Its the only way to become familiar with something.
As for the theory:
A modeless dialog is a window that has no exclusive rights to system resources such as the cursor. It can remain on the desktop in a hidden state while the rest of the control is active and busy with other things and can be hidden and brought to the foreground at will.
I think that in your case the control is only a dialog and that is why you perceive the control to be hidden and shown. That is not true. The control cannot be hidden because running code does not subscribe to the concept of being hidden etc. Only a GUI element can go through these states and that is what ShowWindow is designed for.
|
|
|
|
|
I want to load an array and print the array using pointer. But I can't do it with the program below whose output is also provided...
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],i,j,m,n,**p;
clrscr();
printf("\nEnter the order:");
scanf("%d%d",&m,&n);
printf("\nEnter the elements:\n");
for(i=0;i
|
|
|
|
|
Please, use the 'code block' button to surround your code snippet with <pre> tags, since, as you may see, your code, as it stands, is unreadable.
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]
|
|
|
|
|
Hi apart from that I can not read your code either, I would guess you are going on past end over your array ( see the output of the strange numbers) .
So either fix your post, or you try to find the line where you ran over the border.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|