|
You can turn off the manifest generation step in the linker tool so long as you always distribute the application with the manifest contained in a separate file in the same directory as the executable.
As this page[^] says, Application manifests are copied into the same folder as the application executable file or included as a resource in the application's executable file..
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart
Thanks for helping me.I didnt understand much about manifest files.
But when i deleted Manifest option in rc file it worked.
Regards
Deepu.
|
|
|
|
|
Hi,
Please suggest me any link for MFC samples in vs2003/vs 2005...
|
|
|
|
|
|
i didn"t find any samples in vs 2003/2005...
|
|
|
|
|
you will get the necessary sample codes in codeproject also.
and when you installed MSDN dint you get samples?
|
|
|
|
|
please suggest me any MFC samples in vs2003/2005 with explanation...
|
|
|
|
|
|
Why you didnt sue of examples on the MSDN?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I would like to conditionally prevent the computer from going into sleep.
I know that I will receive the WM_POWERBROADCAST message with the value PBT_APMQUERYSUSPEND, which means "is it OK to suspend.
If I reply BROADCAST_QUERY_DENY, then it's not going to happen.
I would like to differentiate between 2 events.
1. The user puts the computer into sleep.
2. The computer enters sleep because of a configured timeout.
I "could" check if the computer is IDLE at this moment... that might do it.
Just wondering if there's a better answer?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Peter Weyzen wrote: I "could" check if the computer is IDLE at this moment... that might do it.
Are you looking for GetLastInputInfo() ?
"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
|
|
|
|
|
Yes -- "idle" detection is not the issue
Is the overall plan good?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
I am trying to create a tool bar using the class CToolBar. Maybe, I should be using the class
CToolbarCtrl. However, I want to understand both so I can make an informed decision what is best for
my application. I wrote the following code:
BOOL status1 = toolBar.Create( this );<br />
BOOL status2 = toolBar.LoadToolBar( IDR_TOOLBAR );<br />
toolBar.SetButtonStyle( 0, TBBS_CHECKBOX );<br />
toolBar.SetButtonStyle( 1, TBBS_CHECKBOX );<br />
toolBar.SetButtonStyle( 2, TBBS_CHECKBOX );<br />
toolBar.SetButtonStyle( 3, TBBS_CHECKBOX );<br />
toolBar.SetButtonStyle( 4, TBBS_CHECKBOX );<br />
toolBar.SetButtonStyle( 5, TBBS_CHECKBOX );<br />
<br />
const UINT idArray[] = {<br />
IDM_LINES, IDM_RECTANGLES, IDM_ELLIPSES,<br />
IDM_ENLARGE, IDM_ORG, IDM_RESET<br />
};<br />
<br />
BOOL status3 = toolBar.SetButtons( idArray, 6 );<br />
toolBar.UpdateWindow();<br />
BOOL status4 = toolBar.ShowWindow( SW_SHOW );<br />
toolBar.Invalidate();<br />
this->Invalidate();
This code runs as part of the function that creates (OnCreate) the main window of the application.
The return values as stored in status1, status2, status3 and status4 are 1, 1, 1, and 4. However
no tool bar is being displayed. Please tell me what I am missing or how I should go about trying to debug this problem?
Thanks
Bob
|
|
|
|
|
Where is the variable toolBar declared? Just an off the cuff guess, did you declare toolBar locally in the OnCreate method? If so, it would get destroyed when OnCreate returns.
|
|
|
|
|
Thanks for the response. The tool bar is declared/defined in the class of the main window of the
application. Here is how it is defined:
CToolBar toolBar;
I am wondering if the OnPaint routine of the main window needs to do something special to get
the tool bar drawn.
Bob
|
|
|
|
|
You should not have to do anything special in the OnPaint.
Give this a try:
if(!toolBar.Create(
NULL,
this,
IDR_TOOLBAR,
WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_FLYBY | CBRS_SIZE_DYNAMIC
| CBRS_TOOLTIPS
| CBRS_HIDE_INPLACE | CBRS_GRIPPER
) ||
!toolBar.LoadToolBar( IDR_TOOLBAR )
)
{
TRACE0("Failed to create toolbar\n");
return -1;
}
toolBar.SetButtonStyle( 0, TBBS_CHECKBOX );
toolBar.SetButtonStyle( 1, TBBS_CHECKBOX );
toolBar.SetButtonStyle( 2, TBBS_CHECKBOX );
toolBar.SetButtonStyle( 3, TBBS_CHECKBOX );
toolBar.SetButtonStyle( 4, TBBS_CHECKBOX );
toolBar.SetButtonStyle( 5, TBBS_CHECKBOX );
const UINT idArray[] = {
IDM_LINES, IDM_RECTANGLES, IDM_ELLIPSES,
IDM_ENLARGE, IDM_ORG, IDM_RESET
};
BOOL status3 = toolBar.SetButtons( idArray, 6 );
toolBar.UpdateWindow();
BOOL status4 = toolBar.ShowWindow( SW_SHOW );
toolBar.Invalidate();
this->Invalidate();
|
|
|
|
|
Thank you for the response. I tried your code and I found that it did not compile due
to the fact that it calls Create with four arguments and Create takes at more three. I
do not understand what the purpose of the first argument (NULL) is. Therefore, I took
the NULL argument to Create. I left the other three (this, IDR_TOOLBAR and the flags)
in. After doing so, the code compiled but when run, it did not produce a tool bar.
I am thinking that problem might be related to my resource file. Below is the relevant part
of my resource file:
IDR_TOOLBAR BITMAP "TOOLBAR.BMP"
IDR_TOOLBAR TOOLBAR 16, 15
BEGIN
BUTTON IDM_LINES
BUTTON IDM_RECTANGLES
BUTTON IDM_ELLIPSES
SEPARATOR
BUTTON IDM_SHOWTB
BUTTON IDM_EXIT
END
Observe that the name of the bit map and the name of the tool bar is the same. I believe
it is suppose to be that way, right?
Any other ideas?
Bob
modified on Monday, June 22, 2009 5:30 PM
|
|
|
|
|
I am attempting to create a template that has a constructor that takes an array of items of type T, declared as follows:
template <typename T>
class foo {
public:
foo(T* items) {
}
}; Unfortunately, this code will not compile if T is a reference type, because you cannot have pointers to references. Therefore, I would like to create a template specialization that only declares this method if the template parameter T is NOT a reference variable. If it is a reference variable, I want the same method signature but I would like it to be an array of non-reference types to the class. As an example, if I knew that the template parameter base type was 'int', I could create the following specializations:
template <int>
class foo {
public:
foo(int* items);
};
template <int&>
class foo {
public:
foo(int* items);
};
template <int*>
class foo {
public:
foo(int** items);
};
template <(int& )*>
class foo {
public:
foo(int** items);
}; However, I don't know what base type the template parameter is, so I would like to do the above specialization for any base type (for example, I used int, but I could have used string, unsigned, char, or any other class). Is there any way to do this? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Does this meet your needs? It compiles (and runs OK) with gcc 4.0.1, should compile with Visual C++ 7.1 and above, I believe. The Boost type traits[^] do the template specialisations for you, in the derivation of the constructor parameter type.
#include <boost/type_traits.hpp>
#include <iostream>
template <typename T>
class foo {
public:
foo(typename boost::add_pointer<typename boost::remove_reference<T>::type >::type items)
{
}
};
int main()
{
int aa;
foo<int> a(&aa);
foo<int&> b(&aa);
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
This is great advice... I think I am going to hold off on it for now and just delete those constructors so I don't have to install a third-party package, but I will keep this in mind for future work as this appears to be very useful information.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
That part of Boost wouldn't need much installation - the type-traits are a header-only library, so don't need anything to be built.
Alternatively, with a decent standard compliant compiler (like VC++ 7.1 and later), those type traits are easy enough to write, especially for the case you have:
template<class T>
struct add_pointer
{
typedef T* type;
};
template<class T>
struct add_pointer<T&>
{
typedef T* type;
};
I've just built and run that with VS2008 (admittedly only with simple types like int) and it seems fine.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Have you looked at partial template specialization? You could make a partial specialization for reference types and then a general template for the rest of them.
|
|
|
|
|
Do you know the syntax to do such a thing? That is exactly what I am attempting to do, but have no idea as to the syntax. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
From the top of my head (untested) something like:
template <typename T>
class foo<T&>
{
...
};
|
|
|
|
|
Hi All
I'm developing my own CString class. With the idea to make it "much" faster than the standard CString, easily upgradeable, and to include into it some non-standard parsing functions I often use in my work, those will be much better to be part of the CFString object itself, instead of being separate functions.
And in deed I have some noticeable achievements for the basic functions my CFString uses:
My copy() is 35% faster then strcpy()!
My lengh() is 30% faster than strlen().
BUT note that the optimizer often pre-calculates strlen() calls and replaces them with respective numbers!
For example int i = strlen("abc") will eventually generate mov EAX, 3 instaed of generating the asm code of strlen() itself, that happens for hardcoded strings! so in the cases when strlen() isn't replaced by a number, my function is 30% faster
My compare() is 20% faster than strcmp().
I used the inline assembly option of the Visual C++ compiler, the "__asm" command to achieve this.
I also developed an equalizing mechanism, so when I write str1 = str2 the "operator =" actually doesn't copy the data from str2 to str1
the copy occurs ONLY in specific cases when it's needed.
And that mechanism provides about 35 - 40% faster equalizing betweend CFString objects in comparison to the CString equalizing!
So far so good! But in the case with FindOneOf the standard CString beated me badly! CString::FindOneOf is almost twise faster than my CFString::FindOneOf, and my FindOneOf IS written in assembly too. I did everithing I could to tweak it up, but I only reduced the time from 33000ms to 28000ms and CString::FindOneOf does the job for 18000ms, and my function suppose to be faster, now I'll be happy just to equal the score of CString::FindOneOf!
This is the test code I use:
CString/CFString str1("abcdefghijklmnoprs0987654321");
int start = GetTickCount();
for(int pos = 0; pos; 100000000; pos++)
{
index = 0;
index = str1.FindOneOf("1234567890");
}
int time = GetTickCount() - start;
CString strTime;
strTime.Format("%d, %d", time, index);
m_editResult.SetWindowText(strTime);
I looked at the disassembly of the CString::FindOneOf but couldn't find a single loop, I didn't understan anything! there are a lot of stack operations (PUSH POP) a lot of CALLs and they suppose to be slow, I don't have any idea how can this function beat mine!!!
This is the algorithm I use written in C, although it's written in assembly and I believe optimised in the actual function:
const char* pstrTBuffer = m_pstrBuffer;
const char* pstrTSeek = pstrSeek;
do
{
while(*pstrTSeek)
{
if(*pstrTBuffer == *pstrTSeek++)
{
return pstrTBuffer - m_pstrBuffer;
}
}
pstrTSeek = pstrSeek;
}
while(*++pstrTBuffer);
return -1;
In case the code isn't clear enough:
The idea is as simple as possible, compare each character in the main string m_pstrBuffer with each character in the charset pstrSeek
if there is a match return its index if not return -1
I assumed that the problem isn't in my coding technique, it must be generally in the algorithm I use!!!
Does somebody know a better algorithm to implement FindOneOf???
I will appreciate any help - thank you!!!
Sorry for the prolonged question, but I wanted to be as clear as I can in my description.
modified on Monday, June 22, 2009 10:20 AM
|
|
|
|
|