|
Yes, I got exactly that same error message when I tried to "disable Visual Styles", to see if it would make a difference..
So it looks like I've got to take that "very long" road I mentioned..
Well, like I said, in the long term, that's probably a good thing (I'm trying to stay positive)..
So let me ask you: what size Icons are you passing in to the LoadIconMetric() function(s)?
I'm passing in 32x32 pixel Icons, and trusting that the LoadIconMetric() function will either squash it down to the appropriate size, or return an error code if it can't. However, I can no longer trust even the most obvious of assumptions any more, which is why I'm asking..
Also, I can't download your project because you have to be a member of whatever to do so.. But that doesn't matter much - I'm.. uh.. somewhat familiar with the code..
This is maddening - according to you, the code works fine - it just doesn't work for me.. 'cause I'm.. special.. or cursed.. or something..
Well, whatever. Ignore the previous paragraph. I guess I'll just have to keep slogging it out..
Cheers..
|
|
|
|
|
Icon is 32x32 256 colors.
To download the sample you have just register is not a big issue.
|
|
|
|
|
Tacitonitus,
I don't think that a code couldn't work because someone is marked by the obscure forces.
First of all, it was was my wrong about the new operator because it seemed to me that you destroyed the buffer exiting the function.
Of course to use a static or dynamic allocation makes no difference, what really counts is that the memory stay there when shell functions are called.
The Shell_NotifyIcon, with a lot of bugs as usual for MS products, couldn't be not functional. There is a sea of 64 bits applications out there that works.
My personal idea is that the problem is not in your code for Shell_NotifyIcon, but somewhere else. Probably you would take a tighten look to the whole code and try debugging to see if the buffer is consistent each time you use the Shell_NotifyIcon function.
Cheers
|
|
|
|
|
Here i created in DLL project in vc++ 2008. Following are two code files lib.h and lib.cpp.
lib.h
#include "stdafx.h";
class __declspec(dllexport) test
{
public:
test();
static void hello();
static void hello1();
};
class __declspec(dllexport) test1
{
public:
test1();
void hello_test1();
void hello1_test1();
};
lib.cpp
#include "stdafx.h"
#include "lib.h"
#include <stdio.h>
void test::hello()
{
printf("Hello");
}
void test::hello1()
{
printf("Hello1");
}
void test1::hello_test1()
{
printf("Hello_test1");
}
void test1::hello1_test1()
{
printf("Hello1_test1");
}
stdafx.h
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
dllMain.cpp
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
I have written C# code to call the method of test and test1 classes:
consoleApp
[DllImport("lib.dll" )]
public static extern void hello();
[DllImport("lib.dll")]
public static extern void hello1();
[DllImport("lib.dll")]
public static extern void hello_test1();
[DllImport("lib.dll")]
public static extern void hello1_test1();
static void Main()
{
hello();
hello1();
hello_test1();
hello1_test1();
Console.ReadKey();
}
when i run above code i have got following error: EntryPointNotFoundException: Unable to find an entry point named 'hello' in DLL 'lib.dll' 1****<-Click 1 for image
I know about how to call function only(without using Class) of vc++ DLL from C# but i don't know how to call method of any class and how to code that in proper way in vc++.
I know somewhere is mistake in my above code, please experts guide me about my mistake because i tried all from my side.
If anyone has full example like above then suggest me.
Thanks in advance..
|
|
|
|
|
There are two main issues to deal with here.
1. If you want to call functions like that in a C++ DLL, you shouldn't put them inside classes.
2. There is an issue called C++ Name Mangling. This is where the linker exports the functions with additional characters that describe the function signature. To call the functions by their names directly, you must place the definitions inside an "extern C" declaration like so:
extern "C"
{
void Hello()
{ printf("Hello");}
void Hello1()
{ printf("Hello 1");}
}
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I use IAccessible and presently I can get text string from Internet Explorer. I put my code below. But how I can get one word from this text string directly under mouse pointer? Not whole string, ,only one word under mouse pointer?
Thanks in advance.
CString Name;
CPoint CursorPos;
GetCursorPos( &CursorPos );
IAccessiblePtr pIAcc;
_variant_t vt;
BSTR pName = NULL;
BSTR pValue = NULL;
if( SUCCEEDED( AccessibleObjectFromPoint( CursorPos, &pIAcc, &vt )))
{
pIAcc->get_accChild(
BSTR pName = NULL;
if( SUCCEEDED( pIAcc->get_accName( vt, &pName )))
{
if( pName && ::SysStringLen( pName ))
{
Name = pName;
}
::SysFreeString( pName );
}
}
|
|
|
|
|
Hi everyone,
I'm beginner and I need a little help. I have to make RPN (postfix) calculator using stack which is implemented by singly linked list in C. Now I found that but in C++ and I'm having trouble translating it to C. Can you help me getting things to work? I have started from http://www.mediafire.com/view/q833x5sic8eq4sx/from_c__.txt and using a little code from http://www.mediafire.com/view/ewz9so6999ig5x0/using_c.txt I get to http://www.mediafire.com/view/qesca0cg0vzjzac/to_this_in_c.txt code and it debugs but when I enter anything in console it crashes and gives me some assembly code I'm using VS C++ 2010. Please help me to fix this, I can't find what's wrong.
|
|
|
|
|
No one is going to go to those links to see your code. You must post the relevant code snippets here along with any exact error messages.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
You already posted this request in the quick answers thread.
As already told you, you don't have post links, but code (just for your knowledge the links are not even working).
Just a small direction: compile your code with debug info, open a debug session and localize where your code fails. Restrict the place, extract a small snippet showing the problem and post only that small piece if you want any help.
|
|
|
|
|
Back when I was in school, we made our own RPN calculator from scratch (after spending weeks discussing data structures and algorithms on the chalkboard), not converting it from one language to another. As a result, I understand how they work.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
HI all
I want to design a ui widget library , which any iDE developer can use and develop GUI applications. let say library has application widgets include menu bars, tool bars.
at starting point what are functional and non functional requirements should i consider
use cases for UI widget design
Thanks for help
|
|
|
|
|
This is a looooonnnnggg conversation. If you're just starting out, I'd look at what other widget libraries have done. You'll probably also find that a lot of widget libraries have grown into full out frameworks.
Here are a few to look at:
- Qt
- MFC
- wxWidgets
- GTK+
|
|
|
|
|
HI all
I want to design a ui widget library , which any iDE developer can use and develop GUI applications. let say library has application widgets include menu bars, tool bars.
at starting point what are functional and non functional requirements should i consider
use cases for UI widget design
Thanks for help
|
|
|
|
|
I am looking around for topics like MFC vs WTL. There have been many discussions regarding that.
I am trying to make a decision of what type of library to use for programming C++ GUI application on Windows7/8.
One of the strongest arguments in support for using WTL over MFC was the fact that executable of WTL will be around 4x smaller in size than statically linked MFC Application.
Now, given the fact that we are living in 2015 now, does it really matter? If your program is 8MB or 2MB?
From what I see, MFC has many more rich features, and most of all, it is very well supported.
For example, I can install Visual Studio 2013, and build MFC right away and change it the way I want.
On the other hand WTL does not even install properly with its installer under new Visual Studio unless you do some tricks/corrections.
Plus, WTL literature/examples are scattered here and there, and there is very minimal support to it. And most of all, it doesnt have as many nice UI features as MFC does.
The only thing WTL buys me is the fact that its applications will be just more compact, and smaller, but then again, does it really matter for PC's of these days?
Also, MFC gives programmer to do anything what he could do with Win32 API.
Am I missing anything else what is needed to make a decisio whether I should go with MFC or WTL?
So, if one wants to develop some big and professional Windows GUI Application, what is better invest time for coding/learning, MFC, or WTL?
|
|
|
|
|
Member 11203277 wrote: WTL literature/examples are scattered here and there, and there is very minimal
support to it
Documentation, or lack thereof, would be a deal breaker for me, I vote for MFC as there are TONS of examples and lots of documentation. I can't remember the last time I really cared about the size of an executable.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
Member 11203277 wrote: Now, given the fact that we are living in 2015 now, does it really matter? If your program is 8MB or 2MB? Depends.
I'm on a 3G connection with a maximum with 7Gb a month. I won't fret over 6Mb, but most setups are larger than those 8Mb, often including stuff that has already been downloaded.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Member 11203277 wrote: One of the strongest arguments in support for using WTL over MFC was the fact that executable of WTL will be around 4x smaller in size than statically linked MFC Application.
Now, given the fact that we are living in 2015 now, does it really matter? If your program is 8MB or 2MB?
Well, when it comes to MFC, you should probably be dynamically linking to system installed dll's anyways. In that case, the size of the libraries doesn't really matter since you'd be sharing the system MFC libraries (instead of bloating the application).
|
|
|
|
|
I am facing the performance Issue in VS C# 2014, when we adding the item in softtree,setting the image in softtree and changing the font. sample code:-
//Collection.count=10000
for(int i=0;i<=Collection.count;i++)
{
//if collection count is 10k or more than that,facing performance issues.
//time taken by below three lines-6-11 ms.for each record.
int Index = sftTree.InsertItem(parentIndex + 1, desc);
sftTree.set_CellFont(Index , (short)0, new Font(sftTree.Font, FontStyle.Bold)); sftTree.set_ItemPicture(Index,GetImage("Sample"));
}
C# Full Execution Time-3.5 Min
VB6 Full Exceution Time-.19 sec to 1.5 Min
|
|
|
|
|
This is a C++ forum; you're looking for the C# forum, which is immediately below this one in the list.
You'll also need to explain what "softtree" is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am developing an application to copy USB memory sticks. As part of this app, I want to be able to eject the memory sticks when copying is complete. (I DO wonder whether this is necessary as I do a file flush before closing the file) I found a nice little utility (deveject) to implement this and am calling it using WinExec() - I do realise that this is very old and I should be moving on to CreateProcess(), but it has worked well for me in the past and I'm in a bit of a hurry !! Although WinExec() returns 33 (which indicates success), the drives are still accessable aftyerwards and so deveject presumably has not executed properly As a test for the command line used, I placed it in a batch file (deveject -EjectName:"USB Mass Storage Device") in the same directory as deveject.exe, and it executes perfectly, releasing all USB sticks. However, if I use WinExec() to call this batch file, then it doesn't work (but good return code from WinExec() )
So my question is - what am I doing wrong when using WinExec() ? Should I be doing something (permission-wise)to allow the WinExec command line to execute ? My code is as follows:-
CString szCmdLine;
const CString quote = "\"";
szCmdLine = "D:\\StickCopier\\deveject -EjectName:" + quote + "USB Mass Storage Device" + quote;
UINT uiRC;
uiRC = WinExec(szCmdLine,SW_HIDE);
(The command line formed is exactly what I used in the batch file)
Would greatly appreciate any help on this daft (but perplexing) problem !!
modified 10-Mar-15 7:44am.
|
|
|
|
|
Still learning how to code wrote: I placed it in a batch file (deveject -EjectName:"USB Mass Storage Device") in...
Still learning how to code wrote: szCmdLine = "D:\\StickCopier\\deveject -EjectName:" + quote + "USB Mass Storage Device" + quote; Are not quite the same. Try:
szCmdLine = "D:\\StickCopier\\deveject -EjectName:\"USB Mass Storage Device\"";
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hello David,
Thanks for your reply ! I have tried your suggestion but this change produces the command line "D:\StickCopier\deveject -EjectName:""USB Mass Storage Device""" in the debugger (i.e. a PAIR of double quotes whereas single double quotes are needed for the argument to EjectName
Since my original posting, I have tried ShellExecute() and am getting a similar result - ShellExecute() succeeds (RC = 42, which is greater than 33), but the USB stick is still mounted.
New code is as follows:-
CString szFile = "D:\\StickCopier\\deveject.exe";
const CString quote = "\""; // This is actually the character '"'
CString szParameters = "-EjectName:" + quote + "USB Mass Storage Device" + quote;
CString szDirectory = "D:\\StickCopier\\";
HINSTANCE hInstance;
hInstance = ShellExecute(NULL,"Open",szFile, szParameters, szDirectory,SW_HIDE); // returns 42 (> 33 so no error
Doug
|
|
|
|
|
Hello,
I’m new in MFC programming and I have a doubt about destructor's calling in a MFC application.
I wonder if it’s necessary to insert destructors for the classes of the project.
I suppose (but I’m not sure) that Windows automatically calls destructors for classes created by the project wizard (doc, view, frame…) when I stop the program execution and close the program window.
But what’s the situation for classes that I have inserted in the software?
I never put destructor for these objects (dialogs, strings, bitmap, controls, custom objects…)
Is this a problem? What could be the problems in this situation?
Best regards.
|
|
|
|
|
lor75 wrote: I wonder if it’s necessary to insert destructors for the classes of the project. Yes, if you have clean up tasks that need to be done.
lor75 wrote: I suppose (but I’m not sure) that Windows automatically calls destructors for classes... Yes it does.
lor75 wrote: But what’s the situation for classes that I have inserted in the software? Please explain.
lor75 wrote: I never put destructor for these objects (dialogs, strings, bitmap, controls, custom objects…) You mean classes that you're using as opposed to those that you've created?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I try to explain with an example: I create a CBitmap object used to put a bitmap on a custom button control.
Do I have to destroy the object when I exit from the program or the object is automatically destroied?
|
|
|
|
|