|
OK, thanks for the awnser. So I need to create the structures on my own... hmm. That's not so bad, but I hoped there is a way to import the DirectX structures... thanks anyway http://www.aschratt.com
|
|
|
|
|
I'm not saying there isn't, just I don't know if there is without playing around. Al Major's book: COM IDL and Interface Design says to include the ontents of other files you have three options:
#include stdio.h in, say, example.idl and 'all legitimate declarations ... would make their way into the generated example.h file'.
import 'is the standard method for bringing in definitions from other IDL, ODL or C/C++ header files into the main IDL file'.
and:
importlib 'which can only occur in the body of the library statement'. For this need a type library such as .tlb or as can be contained within a COM .dll.
|
|
|
|
|
Yes, but none of those 3 ways are making sense for me. I need types from the "d3d9.h" or "d3dx9.h" file. So why this does not work?
- #include <d3d9.h> will not work since the content could not be understood by the MIDL compiler.
- import [...] will not work since Microsoft does not ship an "d3d9.idl" (or any IDL source) with the DirectX SDK for some reason...
- importlib("d3d9.dll") is the solution which makes most sense, but importlib can only be used inside the library block and this is too late. MIDL needs to know the types when it compiles the interfaces and it first gets to know them after it does.
So I do not brake a leg with creating those types on my own (there are not much I need... just some vectors and matrixes). Using them it should be no problem to create some conversion methods which are only accessible internally. So I could convert those new custom types to DirectX types for using them. http://www.aschratt.com
|
|
|
|
|
I did a couple of searches on my PC and found D3DCOLOR defined in in vmr9.idl:
cpp_quote("#if 0")
typedef DWORD IDirect3DDevice9;
typedef DWORD IDirect3DSurface9;
typedef DWORD D3DFORMAT;
typedef DWORD D3DCOLOR;
typedef DWORD D3DPOOL;
typedef LONGLONG REFERENCE_TIME;
typedef DWORD* HMONITOR;
typedef struct {DWORD dw1; DWORD dw2;} AM_MEDIA_TYPE;
cpp_quote ("#endif")
and in dxtrans.idl I found:
#ifndef DDSURFACEDESC
cpp_quote("#if 0")
cpp_quote("// Bogus definition used to make MIDL compiler happy")
typedef void DDSURFACEDESC;
typedef void D3DRMBOX;
typedef void D3DVECTOR;
typedef void D3DRMMATRIX4D;
typedef void* LPSECURITY_ATTRIBUTES;
cpp_quote("#endif")
#endif
So looks like you're not the only one to come accross this problem.
|
|
|
|
|
Yes, I also found this file around the net... but if I try to define interfaces that way it allways tells me...
error MIDL2011 : unresolved type declaration : IDirect3DDevice9 [ Parameter 'device' of Procedure 'Initialize' ( Interface 'ICamera' ) ]
... if I define the interface that way:
cpp_quote("#if 0")
interface IDirect3DDevice9;
cpp_quote("endif")
And if I define it as an DWORD...
typedef DWORD IDirect3DDevice9;
... the compiler pops up an error "Redefinition of 'IDirect3DDevice9' with different base types".
Still I have no idea how to get the IDirect3DDevice9 interface passed to my interface... any ideas?
// EDIT: at the moment I am simply passing an IUnknown pointer to the method and query back the interface to IDirect3DDevice9...http://www.aschratt.com
modified on Sunday, February 21, 2010 10:55 AM
|
|
|
|
|
Aschratt wrote: Still I have no idea how to get the IDirect3DDevice9 interface passed to my interface... any ideas?
Sorry I'm out of ideas if an IDL definition for IDirect3DDevice9 can't be found - apart from using IUnknown as you mention, .
|
|
|
|
|
Hm thanks anyway... perhaps it is not the "best" solution I am working with, but it is an solution and it does it's work. Thank you very much http://www.aschratt.com
|
|
|
|
|
Hello,
I want to create installation of ATL COM component. I can create .MSI file using setup and deployment project in VS2005. But I want to create .exe file which does not require any MSI installation on machine.
Thanks
abm
|
|
|
|
|
It seems, the VS Setup & Deployment wizard doesn't support single exe setup
|
|
|
|
|
|
Hi,
I would like to find all matches of a specified string in a vector of strings, however I have some problems:
1) 'find' algorithm in FindNumber returns everything to the iterator 'i', starting from the first match. I would like the 'i' iterator to point only to matched strings.
2) if problem 1 is solved, than still 'find' isn't of much use in my case, since it only returns first match.
Can someone help ?
struct sStringStruct
{
string m_nString;
sStringStruct(string m_initString = "") : m_nString(m_initString) {}
};
bool operator == (const sStringStruct &lhs, const sStringStruct &rhs)
{
return lhs.m_nString == rhs.m_nString;
}
int FindNumber(const std::vector<sStringStruct>&v, string nString)
{
typedef std::vector<sStringStruct> t_vec;
t_vec::const_iterator i = std::find(v.begin(), v.end(),sStringStruct(nString));
while(i != v.end())
{
cout<<"MATCH:"<<(*i++).m_nString<<endl;
}
if (i == v.end())
return -1;
return int(i - v.begin());
}
int _tmain(int argc, _TCHAR* argv[])
{
vector <sStringStruct> vec;
vec.push_back(sStringStruct("xxxx"));
vec.push_back(sStringStruct("aaaa"));
vec.push_back(sStringStruct("bbbb"));
vec.push_back(sStringStruct("cccc"));
vec.push_back(sStringStruct("aaaa"));
FindNumber(vec, "aaaa");
return 0;
}
|
|
|
|
|
ekimpl wrote: 'find' isn't of much use in my case, since it only returns first match.
I think that find is very useful in almost all cases (in your case too).
I've modified your FindNumber function and now it works fine.
Here is the commented code:
bool FindNumber(const std::vector<sStringStruct>&v, const std::string& nString)
{
bool found = false;
typedef std::vector<sStringStruct> t_vec;
sStringStruct searched_string = sStringStruct(nString);
t_vec::const_iterator i = std::find(v.begin(), v.end(), searched_string);
while(i != v.end())
{
found = true;
std::cout<<"MATCH:"<<(*i).m_nString << std::endl;
i = std::find(i+1, v.end(), searched_string);
}
return found;
}
Cheers
|
|
|
|
|
Thanks for quick reply. Now that I see Your solution I don't know if I understand the concept of iterators correctly.
I thought that t_vec::const_iterator i = std::find(v.begin(), v.end(), searched_string) would result in i pointing only to the matches, but it is only used to point the first match. And that is why You used recurency to find the next matches.
So if I wanted to know all the indexes of found matches outside of FindNumber, it should return an array of found indexes, yes ?
|
|
|
|
|
ekimpl wrote: Now that I see Your solution I don't know if I understand the concept of iterators correctly.
This[^] is a good place for understanding them.
ekimpl wrote: I thought that t_vec::const_iterator i = std::find(v.begin(), v.end(), searched_string) would result in i pointing only to the matches
In general iterators are used to access elements of a sequence, and can be used in a similar manner to pointers. Consequently an iterator can point only to one concrete element of a sequence at current time, just like a pointer.
ekimpl wrote: So if I wanted to know all the indexes of found matches outside of FindNumber, it should return an array of found indexes, yes ?
Yes, but using indexes is OK only for a std::vector container, because it supports RandomAccessIterator so, you could easily use operator[] .
If you later decide to change the container type (for example to std::list ) then indexes will not work. So in general it is better to fill an array with iterators each pointing to exact matched element. And finally it is not a good idea to return a whole array, I'd prefer accepting this array by reference in my function.
Here is a modified example for your code which will fill indexes of the matched elements:
bool FindNumber(const std::vector<sStringStruct>&v, const std::string& nString, std::vector<int>& indexes)
{
bool found = false;
sStringStruct searched_string = sStringStruct(nString);
const int vec_size = v.size();
for(int i = 0; i < vec_size; i++)
{
if(v[i] == searched_string)
{
indexes.push_back(i);
found = true;
}
}
return found;
}
std::vector <sStringStruct> vec;
vec.push_back(sStringStruct("xxxx"));
vec.push_back(sStringStruct("aaaa"));
vec.push_back(sStringStruct("bbbb"));
vec.push_back(sStringStruct("cccc"));
vec.push_back(sStringStruct("aaaa"));
std::vector<int> indexes;
bool found = FindNumber(vec, "aaaa", indexes);
if(found)
{
const int indexes_size = indexes.size();
for(int i = 0; i < indexes_size; i++)
{
std::cout << "MATCH:" << vec[indexes[i]].m_nString << std::endl;
}
}
You asked about indexes, so I removed the usage of std::find algorithm.
But as I've said before, this solution works only for std::vector .
More general solution is to fill an array of iterators using std::find algorithm.
I hope this helps.
Regards
|
|
|
|
|
Yes, it helped. Thanks a lot for your answers. I get the point now.
|
|
|
|
|
You're welcome!
|
|
|
|
|
Hi,
I have a ATL Exe server sending events(samples) to my client application. For some reason if I hold down the (X) close button on the client window without releasing it. It blocks the ATL exe server from firing the events to the client until I release the (X) button. Is this something to do with the threading model?
Regards,
Anthony
|
|
|
|
|
Kind of. COM uses window messages to communicate. When you hold down the X button, the UI thread enters a modal message loop and won't process COM related windows messages. Maybe have the event handler on a different thread in the client?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi there,
I've written a WTL SDI application, that uses splitter windows. I'd like to know how what messages to listen for to pick up when the splitter windows are moved.
I've tried listening to WM_SIZE, but only the CMainFrame seems to send WM_SIZE messages.
Here's my CSplitterImpl derived class:
template <bool t_bVertical = true>
class CViewSplitterT : public CSplitterWindowImpl<CViewSplitterT<t_bVertical>, t_bVertical>
{
public:
DECLARE_WND_CLASS_EX(_T("Splitter"), 0, -1)
CViewSplitterT(){ }
};
typedef CViewSplitterT<false> CHorSplitter;
typedef CViewSplitterT<true> CVertSplitter;
What should I be listening for in the message map of my CMainFrame?
All suggestions welcomed!
modified on Friday, January 22, 2010 3:29 AM
|
|
|
|
|
When you don't know what messages are being sent, I'd suggest using Spy++ (distributed with Visual Studio) to look at what messages are flying around.
Using that method on a WTL app with splitter that I have, I don't think the main frame gets any notification of splitter position change. The only thing I can see is the views inside the splitter getting WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages when they are resized.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Have a look at this article
[^]
|
|
|
|
|
|
I need a program in PHP which can extract the hidden biders from ebay.I will have to insert the item number and the program must show me all bidders of the auction and their emails.
Also the same program must extract the registered contact information for any specified bidder specially the email address
I will pay for this
If someone can help please contact me at totos_back@yahoo.com
Thanks
|
|
|
|
|
How to copy table with Data and constraints from one database to another database
Database A have 300000 columns
I need above table to copy in Database B but with constraints I am using below Query but here constraints are misssing
SELECT * INTO Table1
FROM A.dbo.Table1
Pls suggest me correct Query
|
|
|
|
|
Wrong forum.
L u n a t i c F r i n g e
|
|
|
|