|
Hi,
Many thanks for help. I tried the following API calls immediately after insert. I use the same m_hStmn for the insert and the select query.
This call is successfull however when I query the returned value using the SQLFetch and SQLGetData the returned SQLINTEGER is always zero!?
SQLExecDirect(m_hStmn, (SQLTCHAR*)_T("SELECT @@IDENTITY AS 'Ident'"), SQL_NTS)
I tried to use the more save SCOPE_IDENTITY() function, however these API calls fail.
The driver returns (for Access table) undefined function.
SQLExecDirect(m_hStmn, (SQLTCHAR*)_T("SELECT SCOPE_IDENTITY()"), SQL_NTS)<br />
SQLExecDirect(m_hStmn, (SQLTCHAR*)_T("SELECT SCOPE_IDENTITY() As [Ident]"), SQL_NTS)
In this case I got from the driver one parameter missing error code:
SQLExecDirect(m_hStmn, (SQLTCHAR*)_T("SELECT SCOPE_IDENTITY"), SQL_NTS)
Can you explain how can I correctly get the inserted row's ID? Why the above calls fail ?
Thanks,
Abyss
|
|
|
|
|
Please anyone help me how to overwrite a string that is store in a file using vc++ source code?
|
|
|
|
|
here's the pseudocode:
1. Read file into string
2. Replace substring
3. Write new string to file.
Look on MSDN on CFile, FILE, CString, ...
Good luck.
No hurries, no worries.
|
|
|
|
|
Hi,
I'm using Visual Studio .NET 2003 since a while now, but there's something that really gets on my nerves from time to time. It's fact that the tabbed browsing can't be on several lines...
Using VS6 and WndTabs it was easy to change the settings to get it the way you wanted.
Does any body know a way to put the tabs of the documents on several lines instead of those ridiculous arrows to browse throught on a single line, or is there any other alternative to find the files quickly (plugin ?, btw the Window/Windows thing is not what I'm looking for ).
Thanks for any help,
- Pierre
|
|
|
|
|
hai i have one problem that i want to delete particular string from text file.for that what should i do?any body help me?
shan
|
|
|
|
|
|
can u give the code for remove string?pls.i will change for my need.
shan
|
|
|
|
|
|
shanweelmas@yahoo.co.uk
shan
|
|
|
|
|
|
Hello everybody!
I have a very annoying problem here.. the thing is, I am optimizing my
application with SSE `intrinsics' in some places, and the data used by
such instructions must be 16-byte aligned, or the program crashes.
So I have this class that contains the SSE data member, which
is aligned properly WITHIN the class. I have also overloaded the `new'
operator to properly handle a single object by allocating memory with
void * operator new( unsigned int cb ) {
void *res = _aligned_malloc( cb, 16 );
return res;
}
The problem comes with dynamic arrays; The compiler seems to add some _extra_
info before the actual array data, without aligning the array data properly after it.
I understand that the extra information is the array length or something like that.
Is there any other function I can override, that gets called _after_ operator new[] to
save such information myself - aligned?
Thanks anyone who helps me out..
I am having bad dreams about unaligned memory all the time.
/Erik
|
|
|
|
|
>> The compiler seems to add some _extra_
info before the actual array data
it adds the size of the array so that the 'operator delete[]()' *knows* how many objects it must delete.
Looks like you need to overload the 'operator delete[]()' so you can implement your own memory management system; and do not fogort to implement the corresponding 'operator delete()' and 'operator delete[]()'
Serge
|
|
|
|
|
Hello, and thanks for your reply!
I don't think it's the delete[] operator that is the problem right now.
I print the pointer that I obtain with _aligned_malloc to the screen (in
my overloaded operator new[]) and then print the pointer obtained by
_using_ the the new[] operator, the latter being unaligned and pointing
to my actual data... so something happens between the aligned allocation
in the overloaded new[] function and my assignment of the new pointer; e.g:
Pointer with _aligned_malloc = 0x00a40030 (aligned on 16-byte boundary).
Pointer after assigning the final object with new[] = 0x00a40034 (not aligned).
Even worse, the compiler seems to add extra extra info there in debug mode
- no simple workaround, such as adding and subtracting 4 bytes to the address.
So I need to be able to completely handle this on my own for my program to work...
hasn't anybody programmed with SSE instructions and come across this problem?
The delete[] operator will be a later problem, correct allocation is the most
important thing right now, so that the program doesn't crasch.
Thanks
|
|
|
|
|
I have an MFC dialog based application and the class associcated with the dialog is named CCoreDlg. In the dialog class I have a function named OnMessage( .... ) which I which like to be called from a plugin.
So, how do get to a this function ? From the main window handle?
What I am trying to accomplish is say:
1) Pass the main application window handle to each plugin
2) From a plugin call pMainApplicationWindow->OnMessage(...)
How would I accomplish this?
|
|
|
|
|
If you're passing the window handle to a plugin then you cannot use it to call the app directly. You need to send it a message (maybe that's why the function is called OnMessage )
Wire up the OnMessage function in the dialog's message map if it's not alreay done.
Define one or more message numbers based on WM_APP, known to the app and the plugin:
#define WM_APP_DEFINE_MSG (WM_APP + 13)
In the plugin:
::SendMessage(hHandlePassedFromApp, WM_APP_DEFINED_MSG, wParam, lParam);
Windows and the MFC framework will conspire to call the OnMessage function for you.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I will look into your method but my OnMessage function passing data that won't work with this solution.
The function declaration is as follows:
BOOL OnMessage( CSystem * pSystem, CMessage * pMessage );
This two items allow passing much more data than wParam and lParam.
I have come up with the following since my post. Tell me what you think of it.
HWND hMainWnd;
hMainWnd = AfxGetApp()->m_pMainWnd->GetSafeHwnd();
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hMainWnd));
if (pDlg != NULL)
{
CCOREDlg *pTemp;
pTemp = (CCOREDlg*)pDlg->GetRuntimeClass();
g_pSystem->pCoreDlg = pTemp;
CSystem * pSys = NULL;
CMessage *pMsg = NULL;
g_pSystem->pCoreDlg->OnMessage( pSys, pMsg );
}
Now I just pass the pointer pCoreDlg to a plugin and it can call my OnMessage function.
|
|
|
|
|
I know this sounds shady, but I assure you its for a network security project, but I basically wish to develop a program which spoofs the source IP address using the winsock API, since I am most familiar with this.
I realize this requires the use of raw sockets, and I am running machines with winxp, so using raw sockets is not an issue for winsock. Is there a resource for raw sockets, resources are a little limited in using them, so if someone could point me in the right direction I would greatly appreciate it.
|
|
|
|
|
I am trying to implement multilanguage support using separate resource .dlls. However, if I load a resource dll other than the default on program startup I get the "Failed to create empty document" message. Has anyone outhere had any luck in a similar situation.
Any examples of using multiple resource .dlls in a multi-document interfaces would be greatly appreciated.
|
|
|
|
|
I am doing it without any problem but the app is far too complex to pick out the bits you need.
I suggest you step through the code to find out where it fails. You're probably missing a vital resource somewhere. It shouldn't be too difficult to find.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Thanks for the reply.
I stepped through the code and eventually the SendMessage() function with WM_MDICREATE returns NULL. My program does not have a menu which could be contributing to the problem but the main resource works fine without it.
Here are the steps I did to try and get this working.
1. create a new .dll project
2. set the project settings to /noentry
3. copied and renamed the .rc file from my original project to a separate directory.
4. added this new .rc file to the .dll project.
Does this sound correct?
Thanks again.
|
|
|
|
|
I am learning about Dump for diagnostic use. I have used it to view information when I close a SDI application.
What I want to know is if there is a way of viewing data while the SDI application is running using the debug window? That way I can monitor data, watch for problems, etc. while someone is running the application in debug mode.
Jerry
|
|
|
|
|
jerry1211a wrote:
What I want to know is if there is a way of viewing data while the SDI application is running using the debug window?
Sure, just set a breakpoint and run the program. When execution reaches that breakpoint, you can view all variables in the current stack frame.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I dont want to use breakpoints. I want the application to keep running. I used to use Borland and there a way to send information to a file or window that you could watch at runtime...without interrupting the program.
Thanks.
Jerry
|
|
|
|
|
Something like:
#ifdef _DEBUG
#define LOG(x) {FILE *f = fopen("log.txt","w+");fputs(x);fclose(f);}
#endif Then use it throughout your program as necessary.
|
|
|
|
|
I am new to C++ .Net and I have been told to move away from MFC to .Net. I have read through a few introduction book on .Net & C++ .Net by Microsoft Press, but so far I have yet to see anything in .Net that's similar to Doc/View or SDI/MDI in MFC. I only see .Net Framework Forms which looks like MFC's Dialog. Is there a MFC equivalent in .Net? How would I go about converting MFC to .Net or create Doc/View/SDI/MDI in .Net? If there isn't one why do I keep hearing people saying to move away from MFC and learn .Net. I would also appreciate any book recommendation. Thanks
|
|
|
|