|
Hello,
I need to read all GUIDS defined inside abcdef_i.c(where abcdef can be any file defining all guids of a COM component) file from DIA SDK?
I need to extract all relavent component's Guids defined under COM component from pdb file. I am using DIA SDK, but always its get_guid returns badPtr(0x000) and it is reported bug of MSFT
Regards
Usman
|
|
|
|
|
why can i code like this:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
template <class T>
void OUT(T c)
{
cout << "!!" << c ;
}
int main()
{
vector<string> st(10, " ");
for_each(st.begin(), st.end(), OUT);
}
i know information about for_each :
/*template <class InputIterator, class Function>
Function for_each (InputIterator first, InputIterator last, Function f);
Apply function to range
Applies function f to each of the elements in the range [first,last).*/
but why they don't use Function Templates instead of function, thank you
|
|
|
|
|
Not sure to answer your question as it is formatted but f can either be a pointer to a function or an object whose class overloads operator()(InputIterator::value_type) .
See http://www.cplusplus.com/reference/algorithm/for_each/[^]
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
This is called 'generic' programming. The term 'generic' means that the definition of the for_each function does not assume anything else from the template argument than that it has an operator()( T ) .
If they would have implemented it using a function pointer,
# they would have needed to specify the function pointer's type (e.g. void (*) (int)) and thus would have disallowed any other type of function (remember C)
# they would have disallowed the use of stateful functions (e.g. accumulators), like often needed for the algorithms
Also, the usage of templates greatly improves the optimizer's chances: it knows _at compile time_ what the body of the for_each block is going to be, so it can often skip parameter pushing etc..., hence reducing function call overhead.
|
|
|
|
|
I have been working on a project for the last year and I have make much progress but much remains. First I will provide headers of what I have done so far.
template <class T> class vector;
template <class T> class matrix;
template <typename T> T norm(vector<T> v);
template <typename T> T norm(matrix<T> m);
template <typename T> void transpose(matrix<T> &m);
template <typename T> void conjugate_transpose(matrix<T> &m);
template <typename T> bool hermetian(matrix<T> &a, matrix<T> &b);
template <typename T> matrix<T> tensor_product(vector<T> row, vector<T> col);
template <typename T> matrix<T> minor(matrix<T> &source, int row, int col);
template <typename T> bool diagonal_dominant(matrix<T> a);
template <typename T> matrix<T> gauss_elimination(matrix<T> &m);
template <typename T> matrix<T> gauss_jordan(matrix<T> &m);
template <typename T> void gauss_siedel(matrix<T> a, vector<T> b, vector<T> x, double tolerance);
Now I can use vector<std::complex> and use it with math equations fine. Same for the matrix template.
So given my work to make these helpful templates, I am now out of my math book big time and into the realm of advanced linear algebra.
This is my Gauss elimination, and I was looking to leverage it to do LU decomposition etc to solve Ax = b more expediently.
template <typename T> matrix<T> gauss_elimination(matrix<T> &mat) {
int i = 0; int j = 0; int maxi;
matrix<T> a = mat;
int m = (int)a.size();
int n = (int)a[0].size();
while ((i < m) && (j < n)) {
maxi = i;
for (int k = i + 1; k < m; k++)
if (std::abs(a[k][j]) > std::abs(a[maxi][j])) maxi = k;
if (a[maxi][j] != 0) {
swap(a[i], a[maxi]);
a[i] = a[i] / a[i][j];
for (int u = i + 1; u < m; u++)
a[u] = a[u] - (a[i] * a[u][j]);
i++;
}
j++;
}
return a;
}
Suggestions?
http://www.contract-developer.tk
|
|
|
|
|
|
Hi to all.
How can I change( set) the active tab in Tabbed MDI app created using VS2008. I need to set active tab from CMainFrame using zero based index (what I need is a pointer to CMFC(Base)TabCtrl so I can call 'SetActiveTab(int id)' )?
Thanks in advance
|
|
|
|
|
HI!
I get a jpg picture control like this:
typedef CMapViewCtrlImplTraits<WS_TABSTOP | WS_GROUP | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CONTROLPARENT> CMapViewCtrlTraits;
template <class T, class TBase = CStatic, class TWinTraits = CMapViewCtrlTraits>
class ATL_NO_VTABLE CMapViewCtrlImpl : public CWindowImpl<T,TBase,TWinTraits>,
public CScrollImpl<T>
{
public:
DECLARE_WND_SUPERCLASS(NULL,TBase::GetWndClassName())
typedef CMapViewCtrlImpl< T, TBase, TWinTraits > thisClass;
}
Problem is when I load a jpg file,the control have rightscroll ,but the message WM_VSCROLL can't be send.
The scroll just visible,it can't do anything.
Why?
|
|
|
|
|
Hi,
See the CBitmapView class in <WTL>\Samples\BmpView\view.h, you may probably use it as-is.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
hello everyone, i still understand this question:
char a = '1';
printf("%d",a ); //can get 49
printf("%c",a ); //can get 1
how can i know why it can printf 49?? somethings have between about char and int ??????
thank you
|
|
|
|
|
See here what is the Ascci decimal for character '1'. Hope you get a clue on how characters are stored in memory while using 8 bit char datatype. Otherwise go for some good books.
|
|
|
|
|
printf("%d",a );
This line says print the decimal value of variable a; since a contains the character '1' it prints the ASCII value, which is 0x31 or 49 decomal.
printf("%c",a );
This says print the character stored in variable a, which is the character '1'.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Experts,
I am facing a strange problem.
I developed a simple COM dll in VS2008 using ATL on vista 32 bit platerform. When I try to register it on windows server 2008, I am getting below error.
The module "D:\TestATL.dll" failed to load.
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .DLL files.
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail.
I searched this problem on google but could not find any solution. Any idea about this.
Solution: http://www.codeguru.com/forum/showthread.php?t=454296
Thanks
Manish
modified on Saturday, November 27, 2010 1:08 AM
|
|
|
|
|
hello
i want to see all files in directory dir that have .txt and rename them to directory dir2 with suffix .cpp how i can do this??
|
|
|
|
|
|
can you write the code of it here?
|
|
|
|
|
If you took the trouble to go and look at the links that Cool_Dev provided you would see some sample code to help you.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Note that people sometimes forget about FindClose() thus leaking a handle. Another important thing is that when FindFirstFile() returns INVALID_HANDLE_VALUE and when FindNextFile() returns FALSE you may want to check if GetLastError() returns ERROR_NO_MORE_FILES or something more brutal.
|
|
|
|
|
void txt2cpp(const TCHAR* path)
{
TCHAR full[_MAX_PATH+_MAX_FNAME];
TCHAR move[_MAX_PATH+_MAX_FNAME];
unsigned int flen;
unsigned int mlen;
HANDLE hf;
WIN32_FIND_DATA fd;
_tcscpy(full,path); flen = _tcslen(full); _tcscpy(full+flen,_T("\\*.txt"));
hf = FindFirstFile(full);
if(INVALID_HANDLE_VALUE!=hf)
{
do
{
if(!(FILE_ATTRIBUTE_DIRECTORY & fd.dwFileAttributes))
{
_tcscpy(full+flen+1,fd.cFileName);
_tcscpy(move,full); mlen = _tcslen(move);
for(;(0<mlen)&&('.'!=move[mlen-1]);mlen--);
_tcscpy(move+mlen,_T("cpp"));
MoveFile(full,move);
}
} while(FindNextFile(hf,&fd));
FindClose(hf);
}
}
comment: not safe for buffer overflow.
|
|
|
|
|
|
When using MFC, we can create dll usign MFC, and create MFC dialog or MFC windows in DLL. And Shows the dialog or windows by export functions.
But how to use WTL in dll? WTL AppWizard can only create exe project, ATL has no enough UI support. What can we do to usign WTL in dll? Create WTL dialogs and WTL windows and other WTL UI components.
Thanks
|
|
|
|
|
Hi,
tank0 wrote: What can we do to usign WTL in dll?
WTL is a template library and as you certainly know templates are compiled when used, not when declared. Thus it is impossible to export uninstanciated template classes from a dll.
That said, you can use WTL in dlls which export only fully instanciated templates like WTL_DLL.ZIP
in the Files section of the WTL support list[^].
Another example is here[^].
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Alain Rist wrote: WTL is a template library and as you certainly know templates are compiled when used, not when declared. Thus it is impossible to export uninstanciated template classes from a dll.
That said, you can use WTL in dlls which export only fully instanciated templates like WTL_DLL.ZIP in the Files section of the WTL support list[^].
Another example is here[^].
cheers,
AR
Thanks for your reply. What I what to do is just like you said.
Export a single function in the dll such as ShowDlg()
What the ShowDlg function do is that creates a modal window and shows.
With MFC, I can just create a "Regular DLL with MFC statically linked" project and in the project use codes like below is enough.
But I don't know what to do with WTL. WTL appwizard can only create exe projects.
extern "C" __declspec(dllexport) void ShowDlg()
{
CDialog dlg(IDD_Dialog1);
dlg.DoModal();
}
|
|
|
|
|
Use an AppWiz generated Win32 dll with the code from a WTL application. Study the referenced WTL_DLL.ZIP code, it's really simple and does exactly what you wish
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I got it, thanks for your help
|
|
|
|