|
CImageList *m_ImageTree;
TV_INSERTSTRUCT TreeItem;
HTREEITEM hTreeItem;
CBitmap bit;
m_ImageTree = new CImageList();
m_ImageTree->Create(15,15, ILC_COLORDDB,0,0);
TreeItem.hParent = TVI_ROOT;
TreeItem.hInsertAfter = TVI_LAST;
TreeItem.item.mask = TVIF_TEXT | TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
TreeItem.item.pszText = _T("TEST");
TreeItem.item.lParam = 0;
TreeItem.item.iImage=0;
TreeItem.item.iSelectedImage=0;
hTreeItem = m_Tree1.InsertItem(&TreeItem);
bit.LoadBitmap(IDB_BITMAP1);
m_ImageTree->Add(&bit,RGB(255,0,255));
m_Tree1.SetImageList(m_ImageTree, LVSIL_NORMAL);
|
|
|
|
|
and you can replace
HBITMAP hBmp = (HBITMAP)LoadImage(NULL,"c:\\a.bmp",
IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
bit.Attach(hBmp);
instead
bit.LoadBitmap(IDB_BITMAP1);
|
|
|
|
|
I am using DLL in one project. I built two DLLs and conresponding libs, but one dll works well and the other does not. That is one dll exports functions correctly, the other produces link error 2019. I checked the dlls by dumpbin, and found the export functions in the right dll look like "FileWrapper_Close" same as the defination of the function, but the other functions in the wrong dll look like "_CopyResamplerState@4", additional letters '@', '4' and '_' added to the name. I built the two dlls in the same way, I could not figure out why they are different. Thanks for your help.
|
|
|
|
|
You've discovered the "name mangling" done by the C++ compiler. If you want your DLL functions to be exported with their names the same way they are defined in code, there are a couple of options.
My favorite way is to define my exports with the extern "C" declaration. For example:
extern "C"
{
BOOL Function(INT Param)
{
// Do stuff
}
}
|
|
|
|
|
|
Hi,
i am trying to solve the following problem.
I got an Dialog and when i close it the coordinates will be saved in registry.
Now if you use Multi-Screen and you close the dialog for example on X: 2400 and Y: 1000 and you remove the second monitor, you have an "out of range" i call it. Now I want to check for all cases,
multiscreen left-side, right-side, or top-on-top (xcuse my englisch).
How can I get the coordinates e.g. on left-side situation ( X must be like -1340)
Using VS 6.0 SP 5
thx a lot
|
|
|
|
|
|
Does not work !!! If I have coordinates which lie out of the visible range of BOTH dipslays for example, the dialog will still be loaded outside my visible range.
One solution is I thougth to get all four Window Edges, left, right, top and bottom (no rectanlge because the displays could be arrangend as L-Form).
anyway, thank you very much for your response
|
|
|
|
|
Michael Dunn has probably given you the simplest, easiest solution!
If you choose to follow the harder solution, keep in mind that the monitors do no have to be arranged to form a rectangle. If you have 3 monitors, they could be arranged in an "L" configuration, so monitor 2 is above monitor 1 and monitor 3 is to the right of monitor 1.
To handle this, look at using enumDisplayMonitors() callback function to determine the coordinates of every monitor, etc.
|
|
|
|
|
This works fine ! Thank you
|
|
|
|
|
Well, now you've just annoyed me!
How did you get that working so quickly? When I decided I needed to use enumDisplayMonitors(), I think it took me a couple of days to get anything working!
|
|
|
|
|
Hello.
I am working on a console C project under VS.net. I want to measure execution times between lines of code. I have looked over the documentation to try to set up "ENABLE PROFILING" on my project. I dont understand how to set it up. Can anyone help me out? Or point me to some examples where it is used.
Jerry
|
|
|
|
|
Hi.........
I noticed that it remains extremely hard to plot by using VC++ 6 itself for readind data and plotting............
Moreover no such sources available, just hybrids!
If someone has one....... TIP TOP,
I would wecome to receive it for personal knowledge!
Thanks..
example of file:(txt file)
Typical header:Solvers, or optimizers, are software tools that help users find the best way to allocate scarce resources.
1 5.258
2 -8.548103675
3 -7.686156375
4 -9.859503638
5 4.211616105
6
.
.
.
with comments With so many domestic distractions, working from home can tempt even the most diligent wor........
Thanks
|
|
|
|
|
I have reread you post several times and I still do not know what the question actualy is!
It sounds like you are talking about a third person tool, or a tool you need to create. That if Visual C++ provided, would just be a bonus.
What exactly do you mean by plotting?
I do not know if I will understand your answer to that question, but somebody else might.
INTP
Every thing is relative...
|
|
|
|
|
Hi! I have a problem calling a function defined in a dll, like this:
__declspec( dllexport ) __int8 __cdecl
freadCharacter( istream &inputStream, char &destinationCharacter )
{
inputStream >> resetiosflags( ios::skipws ) >> destinationCharacter;
inputStream >> setiosflags( ios::skipws );
if ( inputStream.bad( ) )
return 0;
return 1;
}
In the program that uses the dll, I call the function in this manner:
char c;
ifstream src( "input.dat" );
if ( !src )
{
cerr << "Error opening file input.dat\n" << flush;
exit( EXIT_FAILURE );
}
freadCharacter( src, c );
When I run the program, it crashes.
It crashes exactly when trying to execute this line:
inputStream >> resetiosflags( ios::skipws ) >> destinationCharacter;
Can anybody help me by telling what is wrong with my code?
Is it a real problem that I call a function defined in a dll which takes a reference to istream as a parameter? I'm asking this because if I define the function in my application, it works perfectly.
Thanks in advance!
|
|
|
|
|
I would have needed to run some tests, but it may have to do with the fact that the source contains more than one character. I would change the second parameter from a character type to a string type and see what happens.
I dought that will work, because it works in your application. That said, it is where I would start.
How badly does the program crash?
Can you give an error number?
It has been a while since I created a DLL, but I looked up the specs and did not see anything wrong.
I do not see a return type specified for "freadCharacter", but the compiler would scream if that was missing in the actual code.
Eikthrynir wrote: Is it a real problem that I call a function defined in a dll which takes a reference to istream as a parameter?
I can think of no reason why that would cause a problem.
INTP
Every thing is relative...
|
|
|
|
|
I run my program under Windows XP Professional. When it crashes, Windows doesn't show me any run-time error number. It just tells me something like this:
"Test.exe has encountered a problem and needs to close.
We are sorry for the inconvenience." It's the standard Windows message which appears at every program crash. I have tried even to change the second parameter of freadCharacter into an int . I get the same run-time error. I have tested in freadCharacter whether inputStream is open and it is. I thought that maybe that is my problem, but it's not.
Thanks!
|
|
|
|
|
I have no idea what the problem is, but I can give you the name of the best book I know of.
Programming Applicationtions for Microsoft Windows
By Jeffrey Richter.
I consider Jeffrey Richter a master Windows Guru, he has even taught people at Microsoft on the subject. I do not know if he has written anything directly related to C++ (where I think your problem may lay), but search for his name.
Sorry that I did not have time to investigate this furthur myself.
John R. Shaw
INTP
Every thing is relative...
|
|
|
|
|
I really appreciate and thank you for the time spent in helping me solve this problem. I will search for Mr. Jeffrey Richter's book. Thanks again!
|
|
|
|
|
COleDateTime t = COleDateTime::GetCurrentTime();
CString str = t.Format(_T("%A, %B %d, %Y"));
m_edit.SetWindowText(str);
Hi, when i first tried the above code on a new empty project, it worked without any problems.(after including the ATLComTime.h)
But i finally modify and use it in my intended solution and i have 4 errors and 4 warnings:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Form1.cpp
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Generating Code...
Can you figure out what I might nid to do? Tks
|
|
|
|
|
the is my function ....
there is some bug ...
Could you do me a favor !!! Thanks .....
{
HINSTANCE hClcltr=LoadLibrary("sqlite3.dll");
LPFNMLTPLY sqlite3_open;
sqlite3_open = (LPFNMLTPLY)GetProcAddress(hClcltr,"sqlite3_open");
sqlite3 *m_db;
m_db = NULL ;
int m_Rslt=sqlite3_open(_T("testdb"),&m_db);
FreeLibrary( hClcltr );
}
Can't Complier ==> Error Message!!!
'int (int,int)' : cannot convert parameter 2 from 'struct sqlite3 ** ' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
error C2664: 'int (int,int)' : cannot convert parameter 1 from 'char [7]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Thanks
|
|
|
|
|
The sqlite function is defined as:
<br />
int sqlite3_open(<br />
const char *filename, <br />
sqlite3 **ppDb <br />
);<br />
Based on the error, it looks like you've defined the function pointer as:
<br />
typedef int (*LPFNMLTPLY)(int,int);<br />
when it should be
<br />
typedef int (*LPFNMLTPLY)(const char*, sqlite3**);<br />
"My dog worries about the economy. Alpo is up to 99 cents a can. That's almost seven dollars in dog money" - Wacky humour found in a business magazine
|
|
|
|
|
Thanks you ....
You help to solve the problem ......
you are right !
I Find that Line I write ==> typedef int (*LPFNMLTPLY)(int,int);
when I modify ===> typedef int (*LPFNMLTPLY)(const char*, sqlite3**);
The complier is correct !!!
Thanks very much
Thanks
|
|
|
|
|
Okay guys, Can someone point me to a tutorial, beginners area for Embedded
MS CE programming with C++? I've got an Axiomtek GOT-2570S that was just
dropped in my lap. I've been given 6 weeks to learn it, develop an app for
it and have it ready to ship. So, I need a crash course in MS CE programming.
Please help.
Greg
|
|
|
|
|
1. Try the Mobile Development forum.
2. I'm trying to resist a comment about your ID, I really am
Elaine
The tigress is here
|
|
|
|